简体   繁体   中英

What is anchor link that Github uses to link to a specific commit line?

I am trying to figure out what the anchor link (#diff- followed by an alphanumeric string and a line number) for specific file on a commit is, so I can generate links from an external system. Example:

https://github.com/facebook/react/commit/a37012a6b5fb5a1c0c19c962737189aeaebe3684#diff-7a9f2b48de4b0ffcf7b436798ce9aaabL67

This part: #diff-7a9f2b48de4b0ffcf7b436798ce9aaabR336 (the L67 refers to the line)?

So a diff is showing what a "head" commit changed, compared to a "base" commit.

The URL is basically /commit/<HEAD>#diff-<BASE>L<Line>

where <BASE> & <HEAD> are the commit's SHA hashes. As these can't contain "L" it's a good and safe indicator for the line number.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM