How do I navigate to the earliest commit in a Github repository?
In GitHub, is there an easy way to navigate to the earliest commit of a large open source project?
The project has over 13,000 commits as of today. I don't want to have to press the "Older" button on the commit history page hundreds and hundreds of times to get to the initial commit (or first commit).
Solution 1:
There's no obvious UI to do this, but there is a way to construct the right URL to go to page one of the commit log.
Suppose we want to find the first commit of the dotnet/coreclr repository. First take a note of the number of commits in the repository: it is currently 16,634. Now go to the list of commits, and click "Older" once. The URL will be something like this: https://github.com/dotnet/coreclr/commits/master?after=872095a758a3a6191a9798c94a98e8d1e16b2254+34
Notice the +34
part. That's how many commits are skipped. Change that to 16,634 minus 1 minus 35 per page, that gives us this URL, which takes you right to the first page of the coreclr commit history.
Solution 2:
Clone the repository, open with the command line and run $ git log --reverse
This will show the commits in reverse order.
Then you can view it on github once you have the ID(Object Name) of the first commit ... something like... https://github.com/UserName/Repo/commit/6a5ace7b941120db5d2d50af6321770ddad4779e
Solution 3:
I wanted to see one of the earliest commits of nodejs project. I have done the following.
- Visited the site nodejs. Then observed that the total number of commits is around twenty three thousand(23652 to be precise) at this point in time.
- Next I clicked on that commits link and that took me to https://github.com/nodejs/node/commits/master as shown below.
Now scrolled down to the bottom and I found Newer and Older buttons. The Newer button is disabled. I clicked the older button and it took me to https://github.com/nodejs/node/commits/master?after=de37ba34c5d6f3a2d18daf482f850be8fddb4621+34
Now observe that the url has +34. Now I changed that to 23000(since the number of commits I had observed is 23000). So the new url I tried is
https://github.com/nodejs/node/commits/master?after=de37ba34c5d6f3a2d18daf482f850be8fddb4621+23000
- Now I am almost there. With a few more iterations or by older button clicks I reached where I want.
Solution 4:
Feb. 2015: In GitHub, is there an easy way to navigate to the earliest commit of a large open source project?
Yes there now is! (Meaning: without cloning the repo, and applying git log
in the local clone)
Since January 2017, you have "Navigate file history faster with improved blame view" on GitHub.
Whether you're debugging a regression or trying to understand how some code came to have its current shape, you'll often want to see what a file looked like before a particular change.
With improved blame view, you can easily see how any portion of your file has evolved over time without viewing the file's full history.
Here is a demo getting back to the original oldest commit of the git/git repo itself (47K+ commits)... in three clicks!
The trick here is to chose a file likely to be found in the first (or very early) commit, like a README.md
.