Reviewing a Change Commit by Commit

A series of commits can show the internal steps behind an overall change. Compare each relevant snapshot as well as the final integrated result.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a test and fix
  2. Watch what independent use requires
  3. Read each promised change and then their combined result
  4. Check the durability expected between commits

Trace a test and fix

One commit may add a regression case showing the current failure and the next may implement the behavior. The combined result should satisfy the tests. See regression testing for why proving the old failure is useful.

Watch what independent use requires

If the branch expects each commit to build, a change depending on a later helper is misplaced. Commit snapshots and parents provide exact candidate states to verify.[1]

Read each promised change and then their combined result

A review series first introduces a typed result, then migrates a caller, then removes an obsolete path. Reading those commits separately shows why each step exists. Reviewing the final diff can still catch wiring mistakes that appear only when the changes are combined. See commit snapshots.

Commit 1: introduce new result alongside old behavior
Commit 2: migrate caller and its tests
Commit 3: remove path after callers migrate

Check the durability expected between commits

Some projects expect every commit to pass tests independently, helping later bisection. If an intermediate build intentionally needs the next commit, that limits use as a standalone revision. State the repository's expectation during review.

References

  1. Scott Chacon and Ben Straub, Pro Git ↩