Search code examples
github

How to navigate to the earliest commit in a repository?


Is there an easy way to navigate to the earliest commit of a large open-source project in GitHub?

The project has over 13,000 commits as of today. I don't want 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

  • 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/runtime repository. First take a note of the number of commits in the repository: it is currently 125,882. Now go to the list of commits (click on commit count), and click "Older" once. The URL will be something like this: https://github.com/dotnet/runtime/commits/main?after=2aec3816f9bbc0eda3261daa335a05ea0df31b9c+34

    Notice the +34 part. That's how many commits are skipped. Change that to 125,882 minus 1 minus 35 per page, that gives us this URL, which takes you right to the first page of the dotnet/runtime commit history.