Curriculum

Curriculum

Keep Commits Small Enough to Revert Safely

Scenario

Compare two ways of committing a booking boundary fix and a separate quiz-scorer feature.

Selected choicePick a choice below
Result—

Try it yourself

Choose each commit history to see what happens if the quiz feature needs a rollback.

Reveal the explanation
  1. 1 commit: "fix booking bug + add quiz scorer + tweak CSS"

    Hard to revert! Rolling back the broken quiz feature also reintroduces the booking bug.

  2. Commit 1: code fix only; Commit 2: test added next day

    Incomplete snapshot. Commit 1 cannot prove itself if inspected alone.

  3. Commit 1: "Fix booking 0-seat boundary + test"; Commit 2: "Add quiz scorer + tests"

    Clean & reversible! Either commit can be reverted independently in seconds.

Pair each small behavior change with its matching tests in one atomic commit and write a clear message stating what changed and why.

Review first

Your turn

Split three pending changes (negative-seat guard, library limit constant, README typo) into clean atomic commit titles.

Common mistake Bundling all three into one commit called "updates".

Check your work

Commit 1: Reject negative freeSeats with INVALID_FREE_SEATS; Commit 2: Extract MAX_BORROWED_BOOKS constant; Commit 3: Fix README typo.

Quick check

Why is bundling two unrelated features into one commit risky?
Show the answer and reasoning

Correct answer Reverting the buggy feature also reverts the working feature

Atomic commits let you undo one faulty change cleanly without losing unrelated good work.