0

Is there a way to conveniently compare the first (i.e. oldest) and latest commits of a repository on GitHub?

What I know so far

This method is great:

https://github.com/rails/rails/compare/db045dbbf60b53dbe013ef25554fd013baf88134...e0b58f6dc089671cb7ed693346fe0f149b2b363d

Even better, we can save having to copy/paste the last commit by using HEAD, like this:

https://github.com/rails/rails/compare/db045dbbf60b53dbe013ef25554fd013baf88134...HEAD

Is there a way to avoid having to find/copy/paste the first commit?

The ways I know of are require a third party browser hack, or downloading the repo and running git log --reverse, I just wonder if there's something already built into GitHub that can avoid this? (e.g. something like https://github.com/rails/rails/compare/FIRST...HEAD would be ideal, if it exists).

stevec
  • 41,291
  • 27
  • 223
  • 311
  • 1
    Keep in mind that some repos have *multiple* "first" commits. Initial commits have no parents, try `git rev-list --max-parents=0 HEAD` – Romain Valeri Jun 01 '22 at 07:09
  • @RomainValeri good point to keep in mind. What I hope to do is avoid using git at all, and just go directly from my browser and type in the url without having to look anything up. For example, as long as you know the user and the repo, you can *almost* do it, in this example https://github.com/rails/rails/compare/db045dbbf60b53dbe013ef25554fd013baf88134...HEAD the only part I had to look up is the first commit. I hope to avoid it if possible. – stevec Jun 01 '22 at 07:12
  • 2
    The short answer is no, there is no such shortcut in general (including for the reason @RomainValeri mentioned). But if you *control* a repository, you can make a *tag name* for the commit you'd like to use as this "first commit" (whether or not it's the, or a, first commit is irrelevant; GitHub will let you use the tag name as a rev specifier, the same way it lets you use HEAD). – torek Jun 01 '22 at 09:40
  • @torek [FYI](https://github.com/github-community/community/discussions/17876) – stevec Jun 03 '22 at 15:52

0 Answers0