git range-diff
Patching & Rewriting
Compare two versions of a series of commits
The 'git range-diff' command compares two versions of the same series of commits — typically a branch before and after a rebase or a review round. It pairs each old commit with its new version and marks it = (unchanged), ! (changed, with a diff of the diffs), < (only in the old version) or > (only in the new one). Reviewers use it to see what changed between patch series versions.
Synopsis
git range-diff <base> <old-tip> <new-tip>
git range-diff <old-tip>...<new-tip>
git range-diff <old-range> <new-range>[ ] optional| or<arg> placeholder... repeatable--flag option
Examples
After a rebase
git range-diff main old featureOld and new version of the branch, on base main.
Symmetric form
git range-diff old...featureGit finds the base itself.
With ORIG_HEAD
git range-diff ORIG_HEAD...HEADRight after a rebase: before vs after.
Workflow Examples
1
git rebase mainRebase
2
git range-diff ORIG_HEAD...HEADCompare before and after
Troubleshooting
Everything shows as < and >
Cause: The ranges share no similar commits
Check the base and tips you passed
Tips & Pitfalls
Best Practices
- ✓Keep a branch or tag on the old version before rewriting a reviewed series.
Common Mistakes
- ✗Comparing branches with git diff after a rebase — it mixes in every change from the new base.
FAQ
A:
No: it compares commit by commit, ignoring changes that came from the new base.