all guides

Undo Claude, explained by monkey

(the rewind cheat sheet)

comment: UNDO

Claude Code saves a checkpoint every time you send a message, so you can roll back the code, the chat, or both. Here's every way to rewind, what it can't undo, and the git habit that covers the rest.

Every message you send in Claude Code creates a checkpoint, a snapshot of your files at that moment. If Claude breaks something, you can jump back to before that message and get your code back, your conversation back, or both. No git commands needed.

Open the rewind menu

  • Press Esc twice with the chat box empty.
  • Or type /rewind. It also answers to /checkpoint and /undo.

Pick a message, then pick what to restore

The menu lists your messages. Pick the one from just before things went wrong, then choose:

  • Restore code and conversation: both go back to that point.
  • Restore conversation: the chat goes back, your current code stays.
  • Restore code: the code goes back, the chat stays. This is the one for "Claude just broke my app".
  • Summarize from here, or Summarize up to here: shrinks part of the chat into a summary to free up room.
  • Never mind: close the menu.

Three things most people don't know

  • Every message is its own checkpoint, so you can go back more than one step. Just pick an earlier message.
  • You can undo a /clear. If you ran /clear earlier without quitting Claude Code, the rewind menu shows a /resume <session-id> (previous session) entry at the top that brings the old conversation back.
  • Checkpoints survive closing the terminal. They're saved with the conversation, so /rewind still works after you resume a session.

What rewind can't undo

  • Anything a terminal command did. If Claude deleted, moved or copied files with rm, mv, cp or a script, rewind won't bring them back.
  • Edits made by subagents, Claude's helpers, usually aren't restored.
  • Changes you made yourself outside Claude Code, and edits from another Claude session running at the same time.
  • Symlinked and hard-linked files are skipped (pnpm's hard links are one example).
  • Old checkpoints. File snapshots are kept for the 100 most recent checkpoints in a session, and deleted about 30 days after the session last saved one. That's the cleanupPeriodDays setting, 30 by default.

Git covers the rest

Rewind is a quick undo inside one session. The docs say to keep using version control for real history. The habit that saves you: commit before you ask Claude for anything big.

terminal
# once per project
git init

# before a big change: save a known-good version
git add -A
git commit -m "working version before Claude's changes"

# something got wrecked, even by a terminal command?
# put every file git knows about back to the last commit
git reset --hard

You can also ask Claude to do the git part for you:

say this to Claude:
Commit everything as it is now, with a short message that says what works at this point.

Quick reference

cheat sheet
Esc Esc (empty box)   open the rewind menu
/rewind               same thing (also /checkpoint, /undo)
Esc Esc (with text)   clear your draft (Up arrow brings it back)
Restore code          code goes back, chat stays
Can't undo            terminal commands, most subagent edits,
                      changes made outside Claude Code
Real backup           git commit before big changes
Checkpointingthe official docs: checkpoints, the rewind menu and its limits

Monkey believe in you. Now go build.

follow @nocodemonkey

More guides