Often I want to see only a subset of the changes in a branch on GitHub, but I can never remember how to do it. So today I decided to document how I’ve been able to make this work. 💪
GitHub has a compare page where one can see the differences between two revisions. Here is an example using our public sqlite repo showing the differences between two major releases:
The URL is always
https://github.com/, the org name, the repo name,
/compare/, then two revisions seperated by
In the above sqlite example, the two revisions are tags. The compare page works just as well with commit SHAs and branch names.
And one trick I really like to use is the
^ character, which means “back one.” Today I wanted to see only the last two commits I had pushed to a certain branch, so I could compare
branch-name^^...branch-name to see that in the GitHub UI. See below:
And one more trick I like to use is to append the query paramter
w with a value of
1 to mean “ignore white-space-only changes” and then I can really see only the important changes. An example URL combining these two tips would look like:
The compare page is one of GitHub’s best features, and I love websites with hackable URLs – thanks GitHub. What other websites have great, hackable URLs? Get in touch on twitter, instagram, or email us anytime 🚀🆙.