Comparing any two commits on GitHub and GitLab —02 December 2014
Recently I wanted to preserve a diff between two branches. If it’s a pull request, that’s easy, as pull requests normally remain visible even if closed. But I didn’t want to create one just for preserving a diff.
Luckily, GitHub and GitLab both provide a way to view the diff between any two branches, using this URL format:
In fact, the SOURCE and TARGET don’t have to be branches, they can be any ref, for example commit SHA, even short versions, like this:
Just be careful, if you shorten too much, they might not remain unique forever!