⏪ CHAPTER 7 · GIT REVERT
Chef You

The Safe
Undo Button

You pushed a bad commit. You can't rewrite history (others are building on it). git revert creates a new commit that undoes the bad one — safely.

Scene I

Revert vs Reset

Chef You

git reset erases history — dangerous if you've already pushed.

git revert adds a new commit that is the exact opposite of the bad one. History stays intact, but the damage is undone.

Safe for shared branches. Everyone sees the fix without confusion.

⏪ SAFE UNDO Click the bad commits to revert them
Reverted!

🎉 Damage undone, history preserved

The bad commits are still in history (for the record), but their effects are completely undone by the revert commits. No rewriting, no confusion.

This is the safest way to undo mistakes on shared branches.

$ git revert e7b2d18
[main f1a2b3c] Revert "Add untested code"
3 files changed, 2 insertions(+), 15 deletions(-)
Epilogue
Revert is the safe undo.
It adds, never erases. Use it on
shared branches.
git reset
Erases history
⚠️ Dangerous if pushed
vs
git revert
Adds undo commit
✓ Safe for shared code