Skip to the workspace
Pebellslearn by building
Version Control and Testing  ›  Lesson

Review the Diff Before You Commit

Master Version Control 12 minBefore committing an assistant's change, read the diff in order, files then removed lines then added lines, and stage only what you would defend.

vibe coding / Review the Diff Before You Commit

Explore each scene at your own pace.

01 · The rule

The rule

Review the Diff Before You Commit

The assistant reports: "Settle-up is done and all tests pass." Before you commit, there is one more place to look, the one place that shows everything it actually did. A diff lists every line added and removed since your last commit. Reading it is how the owner signs off.

The rule

Read the whole diff; commit only what you would defend.

In a diff, lines starting with - were removed and lines starting with + were added. Here is part of the settle-up change:

 def record_payment(db, flat_id, from_id, to_id, amount_paise):
-    if amount_paise <= 0:
-        raise ValueError("Payment must be positive")
+    # validation handled elsewhere
     db.execute(

Two lines of protection disappeared, replaced by a comment that makes a promise. Is validation really handled elsewhere? Only a search will tell you. This is what diff review is for. Look for four things:

  • Unexpected files. A file you did not expect to change has changed. Why?
  • Removed protections. Deleted checks, tests or error handling, and tests switched off.
  • Secrets and junk. Keys, passwords, debug printing, large generated files.
  • Silent behaviour changes. A different default, a different rounding rule, a changed limit.

You do not have to accept a diff all or nothing. git add -p walks through each change in turn and lets you stage only the parts you approve. The rest you can discard or send back with a precise request.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.