Review a Revised Agent Patch with Git range-diff
You reviewed a patch that raised the retry limit from two attempts to three. After you asked a coding agent to revise it, the branch still contained one commit titled “Define retry policy.” Would your approval cover the new version? In our example, the second draft quietly raised the limit to five. The commit title stayed the same.
Git range-diff compares two versions of a patch series. It helps a reviewer find which commits deserve a second look after an agent amends or rebases its work. A file comparison answers a different part of the review: what would actually change in the resulting tree? In this example you need both views. Git range-diff manual
Save the version you reviewed
On the feature branch, before requesting revisions, save a local branch pointing at the reviewed commit. For a series based on the current main branch, you can also save its common ancestor. Choose unused names for these references.
git branch review-v1 HEAD
git branch review-base "$(git merge-base main HEAD)"Once the agent has committed the revision, compare the two series. This invocation assumes the revision still has the same base.
git range-diff review-base..review-v1 review-base..HEADEach range selects the feature commits after its base. If the agent also rebased onto a newer main, use the actual new base on the right. Comparing the two tips directly in that case can include unrelated upstream edits. Uncommitted edits also need a separate look with git diff.
Read the result when Git cannot match two commits
We ran a small local example with Git 2.47.0. Both drafts changed a single line of retry.conf. Git's default matching reported one commit on the left and one on the right, each without a partner. The commit subjects were identical. Here is the observed output:
1: 701adc8 < -: ------- Define retry policy
-: ------- > 1: 4fdb38d Define retry policyRead the left arrow as “only in the first series” and the right arrow as “only in the second.” Git estimates which patches correspond. An unmatched pair is a reason to open the files before approving. When it does find a pair, an equals sign denotes an unchanged patch and an exclamation mark flags a difference. Git documents the matching algorithm and describes the output as intended for human readers. How Git pairs commits
Here the two versions shared the same base, so we compared their final file directly:
git diff review-v1 HEAD -- retry.confThe old line was max_attempts=3 and the new line was max_attempts=5. Backoff and timeout were unchanged. That gives the reviewer a specific question for the agent or author: why should a failed request now get two more attempts? A passing test that checks only whether a request eventually succeeds might miss that change.
Reproduce the example
Download the example shell script, inspect it, then run it locally:
sh git-range-diff-retry.shThe script creates a fresh temporary repository, commits the two-attempt baseline, saves the first revision under a tag, then amends the commit and prints both comparisons. It uses Git and standard Unix shell utilities. Commit IDs vary with commit metadata. The script exercises Git on synthetic data and requires no model account.
For one file on an unchanged base, the direct file diff may be all you need. Reach for range-diff when the review spans several commits and you want to recover the structure of the earlier review. Then open the affected files and run the checks that establish the intended behavior. Git diff reference



