After a rebase I always wonder if I broke something along the way. A normal git diff between the old and new branch also shows everything that came in from main, which drowns out the bit I care about. git range-diff compares the two series of commits, patch against patch.
git range-diff @{u} @{1} @
That’s the example from the git docs for a rebase: the upstream as the base, @{1} as the branch before the rebase and @ as the branch now. The docs say the base doesn’t have to be the exact point where the branch forked off.
The output pairs up the commits. In the doc example, = between two commits means the patch didn’t change, ! means it did, and a diff of the diff follows. A commit with > is new in the second range and < means it went away.
It’s also handy for reviews. When someone force-pushes a new version of a pull request, compare the old and new version in one go:
git range-diff main old-branch new-branch
That’s the <base> <rev1> <rev2> form. There’s also git range-diff A...B if you prefer a symmetric range.
Caveat: the docs say the output may change between versions, so read it with your eyes and don’t parse it in a script. And @{1} reads the reflog, so it only points at the pre-rebase branch right after the rebase. Do something else on the branch first and it points somewhere else.
Further reading: git-range-diff documentation