Menü schliessen
Created: May 9th 2025
Last updated: May 9th 2025
Categories: Common Web Development,  IT Development
Author: Tim Fürer

GitHub: How to Compare Repository by Commits

Tags:  Git,  github,  guide,  web
Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

Sometimes you want to compare a repository's state between commits. GitHub supports this functionality but doesn't provide a UI method to get to it. Here's how to use it.


Getting Commit Hashes

Firstly, you'll want to get the hashes of the commits you wish to compare. In your repository's commit history, to the right of each commit, you'll see its shortened hash as well as an option to copy the full hash. Either will work for us.


Doing the Comparison

Once you have the hashes, to do the comparison, you have to create and view a specific URL. You can use the following template:

https://github.com/{organisation or user}/{repository}/compare/{commit hash A}..{commit hash B}

An example comparison URL could be: https://github.com/lexo-ch/acf-image-focus/compare/0c13485..f67a004

Mind the two (2) periods between the commit hashes. They indicate to GitHub that the comparison should be between commits. If you use three (3) periods, the comparison will be understood as between two branches instead.