Finding the Real Mistake
git log --oneline -- cookies.md
git show <hash>
A real, genuine diff — the exact change that broke things, found directly in real history.
The Safe Undo
git switch -c fix/cookie-baking-temp
git revert <hash>
A real, new commit — "Revert '...'" — that applies the exact inverse of the original real change. The original commit still exists in history; a new one now cancels it out.
Landing It the Normal Way
git switch master
git merge --no-ff fix/cookie-baking-temp -m "Merge pull request: revert cookie baking temp"
git push
Even undoing a mistake goes through the same real, reviewed process as any other change — exactly what this block's own protected-branch hook requires.
Frank Chen opened a real PR "speeding up" cookie baking — reviewed for code cleanliness, but nobody caught that 250C for 5 minutes would genuinely burn every batch. It merged. It is now part of master's real, permanent history.
On a shared branch, git reset --hard would be a real disaster: it rewrites history that a teammate might already have pulled, and force-pushing it away is exactly the kind of damage Block 2.6 exists to prevent. git revert is the real, safe alternative — it creates a genuine NEW commit that undoes the change, adding to history instead of erasing it. Nothing anyone else has already pulled is ever invalidated.
git revert <commit>
Creates a real, new commit that applies the exact inverse of a given commit's changes. Confirmed directly in this lab: the original "Speed up cookie baking time" commit still exists in history — a new "Revert ..." commit now cancels its effect.
Corrective history vs. rewritten history
Reverting adds a real, new commit; resetting or force-pushing removes or rewrites real, existing commits. On any branch other people might already have pulled, only corrective history (revert) is genuinely safe.
Takeaways
- git revert creates a real, new commit that undoes an earlier one — it adds history, never removes it
- On any branch others might have already pulled, revert is safe where reset --hard is genuinely dangerous
- The original mistaken commit still exists in history — reverted, not erased, which keeps the record honest
- Even a revert goes through the same real, reviewed PR process as any other real change