Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I navigate to the earliest commit in a Github repository?

Tags:

github

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

like image 867
jdw Avatar asked Oct 09 '22 14:10

jdw


People also ask

How do I navigate to a commit in github?

To search for a hash, just enter at least the first 7 characters in the search box. Then on the results page, click the "Commits" tab to see matching commits (but only on the default branch, usually master ), or the "Issues" tab to see pull requests containing the commit.

How do you look at a previous commit?

If you want to look at previous commits, you can use git log and its many arguments. If you want to checkout an actual commit to view the files in an editor, just use git checkout to move to any commit you want. When you are finished, just do git checkout master to return to your current state.


1 Answers

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.

like image 161
Roman Starkov Avatar answered Dec 03 '22 05:12

Roman Starkov