Link to a specific (current) revision on GitHub
Here is a sample project on 开发者_运维问答github: http://github.com/ripper234/Test-grails-project
I would like to capture the latest revision, and send a link to it to someone, so that even if the project changes later he will see the specific revision I was talking about. I guess forking could do that, but it's overkill.
How do I do that?
Just press y
and the URL will change automatically to reflect the current version.
Source
To access a single file or directory:
- While browsing directories: Click on the "latest commit <refid>" link at the top of the file list, and then "Browse code" in the blue area near the top.
- While viewing a file: Click on "History" and then on the "<>" button next to the refid to get a link.
let's say you would like that the someone you send this link
- http://github.com/ripper234/Test-grails-project/commit/c3110a562339a20eaa4c99e25d2e92538bd6c23d
has to work on the resulting code of this commit.
he would do this:
- git clone git://github.com/ripper234/Test-grails-project.git
- cd Test-grails-project
- git checkout c3110a562339a20eaa4c99e
- git branch c3110a562339a20eaa4c99e
now the user has a branch with the code of the mentioned commit.
does this answer your question? -> not sure if I understood it right...
To show the state of the project at a specific commit:
https://github.com/
<user>/
<project>/tree/
<commit-hash>
For example:
https://github.com/toraritte/software-licensing-a-primer/tree/9f122e02949f966445ad37b1541b70114c9dd602
or with shortened hash from
git log
https://github.com/toraritte/software-licensing-a-primer/tree/9f122e0
The easiest way without editing the URL is:
- Choose a commit (either the latest or from the list of commits)
- Select "Browse files"
as mentioned in other answer - for latest commit y
is the shortcut
for any commit
click on commits
and then click on code
icon (octicon-code)
The URL format is as follows: https://github.com/USERNAME/REPO/blob/COMMITID/FILENAME
Replace the capitalised elements with details for your case
精彩评论