StoicBuilder

HandbookIII the CastraReverting a change

IIIthe Castra, Stay in control

Reverting a change

1 min readUpdated 28 November

In plain words

Reverting makes a new commit that undoes an earlier one, so the bad change leaves your code but stays on record.

Where you see it

The agent "fixed" a spacing bug in Quill and now nobody can log in. Lovable's history lets you restore an earlier version; in git, the same move is git revert on the commit that broke it.

Terminalterminal
$ git log --oneline -2c7e21f0 Fix sidebar spacing9b4a1d2 Add note sharing$ git revert --no-edit c7e21f0
This adds a commit that undoes c7e21f0 and leaves every other commit alone.

What goes wrong

  1. Reaching for git reset --hard

    Reset moves the branch backwards and throws away later commits and any unsaved work. On a branch you've already pushed, it also rewrites history other people rely on.

    git reset --hard HEAD~3
  2. Asking the agent to undo it in words

    The agent rewrites the code from memory and gets it nearly right. Reverting the commit gives you the exact old code back.

  3. Reverting the code but not the database

    If the bad commit included a migration, the database keeps whatever that migration did after you revert the code. Check whether the commit touched the schema.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Use git log to find the commit that broke login, and undo it with git revert rather than editing the code by hand or using git reset. Show me the commit you reverted and the files it changed, and tell me if it included a database migration.

Quick check

Sign in to earn +10 XP for it

Yesterday's commit broke QuickBite's checkout. Today's three commits are fine. What should you do?

Got a prompt that touches reverting a change?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.