Menü schliessen
Created: May 9th 2025
Last updated: June 13th 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 wish to compare a repository's state between two commits. GitHub supports this functionality but doesn't provide a visual interface to initiate it. Here's how to access 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

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