How to link to specific line number on github

后端 未结 7 692
滥情空心
滥情空心 2020-11-28 00:57

I know I can link to a specific line number on a file on a github repo (I\'m sure I\'ve seen this before)...

Can someone tell me how to do this?

7条回答
  •  醉梦人生
    2020-11-28 01:03

    @broc.seib has a sophisticated answer, I just want to point out that instead of pressing y to get the permanent link, github now has a very simple UI that helps you to achieve it

    1. Select line by clicking on the line number or select multiple lines by downholding shift(same as how you select multiple folders in file explorer)

    2. on the right hand corner of the first line you selected, expand ... and click copy permalink

    3. that's it, a link with selected lines and commit hash is copied to your clipboard: https://github.com/python/cpython/blob/c82b7f332aff606af6c9c163da75f1e86514125e/Doc/Makefile#L1-L4

提交回复
热议问题