A rebase can change every commit identifier on a branch while preserving most of its patches. Reviewing only the final file diff can hide an accidental omission in an intermediate commit, while treating every rewritten commit as new repeats work that a reviewer has already done. Compare the old and new patch series, then verify the resulting behavior.
This guide covers review of a linear topic branch before its replacement history is shared. The commands were exercised with Git 2.45.2 on Windows and use syntax accepted by PowerShell and Bash. Branch names are synthetic. No command below updates a remote or performs the rebase itself.
Preserve the two versions and their bases
Before rewriting a private branch, preserve its current tip under an unused local reference. Also record the exact base that defines the original series. After the rewrite, record the new base separately. A branch rebased onto a newer main branch has two different comparison boundaries.
For a synthetic review, assume review/base-before and review/base-after already identify those bases. Preserve the current topic tip and inspect all three references:
git branch review/topic-before HEAD
git rev-parse --verify 'review/base-before^{commit}'
git rev-parse --verify 'review/base-after^{commit}'
git rev-parse --verify 'review/topic-before^{commit}'
The first command creates a local branch without changing the checkout. If that name exists, stop and select another name rather than overwriting evidence. The verification commands resolve commit identities; the revision parsing manual documents this explicit verification form.
Once the intended rewrite is complete, give its tip the unused name review/topic-after. Keep the four resolved identities with the review. Names make commands readable, but the identities explain what was actually compared if a reference moves later.
Do not assume that the current main branch is still the original base. It may have advanced while the topic was being revised. If the old tip was not preserved, use the reflog recovery workflow to locate it before making further history changes.
Compare bounded series rather than branch labels alone
With both versions available, compare each series against its own base:
git range-diff --no-color review/base-before..review/topic-before review/base-after..review/topic-after
The range-diff manual describes matching commits by similarity between their patches. Its summary marks matched unchanged patches with =, changed matches with !, and unmatched old or new commits with < or >. Matching is a heuristic, so use it to direct inspection rather than certify equivalence.
In a synthetic revision, a validation commit might match unchanged while a request handler commit shows an intentional adjustment. A small changed patch can also appear as a removed-and-added pair when the heuristic does not match it. An unmatched old test commit deserves investigation: it may have been dropped accidentally, folded into another commit, or made unnecessary by a changed design. The marker cannot decide which explanation is correct.
Using one shared base for both ranges can accidentally include unrelated upstream work. Conversely, a range that starts too late can exclude a dropped prerequisite. Resolve boundary mistakes before interpreting a large comparison as a complicated rewrite.
The default comparison ignores merge commits. For a branch whose meaning depends on merge resolutions, inspect those resolutions separately with tooling appropriate to the installed Git version. Keep that limitation visible in the review record.
Follow every changed or unmatched patch to its intent
For each changed match, identify the intended behavior before reading individual added and removed lines. A changed commit message can explain a renamed concept; a changed condition can alter an authorization boundary. Give the latter a behavioral check even when the surrounding patch looks familiar.
Review conflict resolutions against both the original requirement and the new base. A resolution that compiles can still discard validation introduced upstream. Compare nearby callers, error handling, and tests rather than accepting the mechanically resolved file as the complete change.
When commits were split or combined, trace the original responsibilities into the new series. Check that the tests moved with the behavior they protect and that an intermediate commit does not rely on a later correction. Record intentional changes at the responsibility level so a reviewer can follow them despite different commit boundaries.
Keep unrelated cleanup out of this review where practical. If the revision includes a necessary cleanup, explain how it affects comparison and provide a focused test for the behavior it touches. The diff review guide provides a complementary process for inspecting that remaining risk.
Review the final tree and run the relevant checks
Patch correspondence and final repository contents answer different questions. Compare endpoint trees to inspect their total difference:
git diff --stat review/topic-before review/topic-after
git diff review/topic-before review/topic-after
The Git diff documentation defines comparison between two commits. When the base changed, this endpoint difference also includes upstream changes, so it should not be read as a list of edits made during conflict resolution.
Run the checks appropriate to the rewritten tip. Include tests that exercise the conflict boundary, generated outputs that depend on ordering, and a build from the actual new checkout. A previous passing result belongs to the previous commit, even if the series comparison looks small.
If a test fails, retain both versions while diagnosing the cause. Avoid repeatedly rewriting the only remaining reference to the failing state. A separate worktree can keep each candidate available without mixing local edits or generated files.
Attach evidence to the reviewed revision
Record the old base and tip, new base and tip, intentional patch changes, and checks performed. The useful review statement identifies the exact new revision and the changes that required renewed attention.
Keep range-diff output as human review material. Its documentation explicitly warns that the format is not a stable machine interface. An automated approval system should not infer safety from one marker or parse its presentation as a compatibility contract.
Before sharing replacement history, follow the repository's collaboration policy and confirm that the reviewed tip is still the proposed tip. If another change arrived after verification, compare and check that change too. The durable result is a review tied to a known revision, with every removed responsibility either accounted for or restored.
Was this guide useful?
Your rating helps us prioritize clearer, more practical technical content.
Review diffs, run checks, and prepare the release in Arezgit.
Keep Git review, security scanning, API checks, database inspection, and release preparation together in one local desktop application.
Explore Arezgit