ripper234
ripper234

Reputation: 230048

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?

Upvotes: 45

Views: 30640

Answers (6)

Alex Taylor
Alex Taylor

Reputation: 131

The URL format is as follows: https://github.com/USERNAME/REPO/blob/COMMITID/FILENAME

Replace the capitalised elements with details for your case

Upvotes: 1

Tim Čas
Tim Čas

Reputation: 10867

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.

Upvotes: 18

toraritte
toraritte

Reputation: 8283

To show the state of the project at a specific commit:

https://github.com/<user>/<project>/tree/<commit-hash>

For example:


The easiest way without editing the URL is:

  1. Choose a commit (either the latest or from the list of commits)

enter image description here

  1. Select "Browse files"

enter image description here

Upvotes: 10

bhv
bhv

Reputation: 5378

as mentioned in other answer - for latest commit y is the shortcut


for any commit

click on commits

enter image description here

and then click on code icon (octicon-code)

enter image description here

Upvotes: 2

Anmol Singh Jaggi
Anmol Singh Jaggi

Reputation: 8576

Just press y and the URL will change automatically to reflect the current version.

Source

Upvotes: 50

udo
udo

Reputation: 5190

let's say you would like that the someone you send this link

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...

Upvotes: 5

Related Questions