You asked for a small change. The AI touched six files, the app won't start, and you're not sure what it did. This happens to everyone who builds with AI, including professional developers. The good news: you can almost always go back, as long as you know which "undo" to reach for.
There are three levels of undo when you build with Cursor or Claude Code. Learn all three and an AI mistake goes from scary to mildly annoying.
Level 1: the AI tool's own undo (checkpoints)
Both tools keep their own short-term history of what the AI changed.
In Cursor, the Agent creates checkpoints as it works. In the chat, you can click a checkpoint in the conversation and choose to restore it, which puts your files back the way they were at that point. Your chat messages stay where they are.
In Claude Code, every prompt you send creates a checkpoint. Type /rewind (or press Esc twice when the input box is empty) to open the rewind menu. Pick the prompt you want to go back to, then choose whether to restore the code, the conversation, or both.
Checkpoints are great for "that last answer was bad, go back one step". But they have real limits, and Claude Code's own docs spell them out:
- Commands aren't tracked. If the AI deleted or moved files by running a terminal command (like
rmormv), rewinding won't bring them back. Only edits made through the AI's file-editing tools are tracked. - Changes you made by hand usually aren't tracked.
- They don't last forever. Claude Code keeps snapshots for the 100 most recent checkpoints in a session and cleans old sessions up after about 30 days by default.
- They are not version control. Claude Code's docs say it directly: checkpoints are for quick, session-level recovery, and you should keep using git for permanent history.
So checkpoints are your seatbelt, not your airbag.
Level 2: git save points (commits)
Git is the undo history for your whole project. It doesn't care whether a change came from the AI, from a terminal command, or from you. If it was saved in a commit, you can get back to it.
The habit is simple: make a save point before every big change. In a terminal, that's two commands:
git add -A
git commit -m "checkpoint: login page works"
If you'd rather click than type, GitHub Desktop is a free app for Mac and Windows that does the same thing with buttons. You don't need to upload anything to GitHub to use it.
Then, when the AI goes off the rails, you have options:
- See what changed:
git statuslists changed files, andgit diffshows the exact lines. - Throw away everything since the last save point:
git restore .resets your tracked files to the last commit. (New files the AI created stay around.git clean -nshows them without deleting anything.) - Undo one specific old commit safely:
git revert <commit id>adds a new commit that reverses it, without rewriting history.
One warning. Some git commands throw work away permanently: git reset --hard, git clean -f, and git push --force are the big ones. If your AI suggests one of those, stop and ask it to explain in plain English what will be lost. Better yet, tell it in advance not to run them without asking (there's a copy-paste rule for that below).
Level 3: rescue from history (when you think it's gone)
Even after a bad reset, git usually remembers. git reflog lists every place your project has recently been, including commits that look "lost". You can create a branch from one of those entries and get your work back:
git reflog
git branch rescue <id from the list>
git switch rescue
This works for things that were committed at some point. It can't recover changes that were never saved in a commit, which is exactly why Level 2 matters so much.
Which undo should you use?
| What happened | Reach for |
|---|---|
| The AI's last answer was bad and you haven't done anything since | Checkpoint (Cursor restore, Claude Code /rewind) |
| The AI ran terminal commands that deleted or moved files | Git: git restore . back to your last save point |
| Things broke a while ago and you're not sure when | Git: look through git log, then git revert the bad commit |
| You ran a reset and lost a commit | Git: git reflog and a rescue branch |
Make the AI remind you
The easiest way to build the habit is to make the AI nag you. Paste this into your Cursor rules or your CLAUDE.md file:
Before any big change (more than one file, a new feature, or anything
touching the database, login or payments), stop and remind me to make
a save point first: git add -A, then git commit -m "checkpoint: <what>".
Never run git reset --hard, git clean, git push --force or rm -rf unless
I say "yes" after you explain in plain English what will be lost.
Rules guide the AI, they can't force it. But this one makes the two most painful moments (no save point, and a command that wipes work) a lot less likely.
Get the rules ready-made
This checkpoint rule is one of the 10 rules in our free starter pack, along with a one-page launch checklist. They come as ready-made files for Cursor and Claude Code, so setup takes a few minutes. No card needed.
If you want the full set, the Ship-Safe Starter Kit ($19) includes a plain-English git "undo" cheat sheet ("I broke it, how do I go back?") where every command was tested in a practice project, plus 9 Cursor rules, a ready-made CLAUDE.md and a pre-deploy security checklist.
The short version
- Checkpoints undo the AI's last few edits, inside one session.
- Git commits undo anything, as long as you made a save point first.
git reflogrescues commits you thought were gone.
Make a save point before every big change, and you can let your AI try bold things without fear.
Vibe Shipped is independent and not affiliated with Cursor (Anysphere, Inc.), Anthropic, PBC, or GitHub. Written with AI assistance and reviewed by a human.
Want these rules ready-made?
The free starter pack has them, set up for Cursor and Claude Code.