2020-08-20 #git #github

Things you didn't know you could diff in GitHub

If GitHub is your daily driver or you've contributed to open source at some point, you've probably seen the comparison screen before.

Screenshot of GitHub's compare screen

"Compare and review just about anything"

They're not lying. You can compare a lot in there, but most of it isn't available in the UI. Here are a few tricks you probably didn't know about.

Comparing with a previous commit


Live example

If you compare the current version of master with a previous commit, use the commit hash separated by three dots.

Comparing commits


Live example

If you want to compare two arbitrary commits, use the commit hashes separated by two dots.

Time-based comparison


Live example

You can also compare a branch to a specific point in time. The date can either be absolute (master@{2020-08-01}...master) or relative (master@{10day}...master).