How can I diff two branches in GitHub?
Use the compare feature to accomplish this.
To compare different versions of your repository, append
/compareto your repository's path.
If you are on any branch other than the default branch (often 'master') you should see a link to compare:
Click it and you should get redirected to the compare-tool where you can select branches or commits to compare
UPDATE December 2021
GitHub seems to have hidden this option, and it is now behind the "Contribute" drop-down:
Expanding on @Ari M's answer. URL format is as follows:
<SOURCE BRANCH OR COMMIT>
<TARGET BRANCH OR COMMIT>
Note the difference between
... (2 and 3 dots).
2 dots: show all commits that TARGET has but SOURCE doesn't and commits that SOURCE has but TARGET doesn't.
3 dots: show all commits that TARGET has but SOURCE doesn't. You usually want this.
E.g. to see what was added in the
gh-pages branch compared to
There is also another way to achieve this on GitHub, Just try to create a new Pull Request with the branches you would like to compare.
branch-1 <- branch-2 or branch-2 <- branch-1
On the bottom, you can see the file and commit difference between those branches. Just don't Create the Pull request if you don't want to merge these two.