← All posts

How Do I Undo Changes Claude Code Made?

Claude Code saves a checkpoint before every prompt you send. Rewinding is one command, but it has blind spots worth knowing before you rely on it.

November 17, 2026 6 min read Guide
Quick answer

Run /rewind (alias /undo), or press Esc twice with an empty prompt. Pick the prompt you want to go back to, then choose Restore code and conversation, Restore conversation, or Restore code. Claude Code takes a checkpoint before every prompt that starts a turn, so you can step back one prompt or many. It only tracks edits made through Claude's file editing tools: files changed only by shell commands, by you outside Claude Code, or by most subagents are not restored, so keep using git for anything that matters.

How do checkpoints work?

According to the checkpointing docs:

What are the rewind options?

OptionCodeConversationUse when
Restore code and conversationRevertedRevertedThe last attempt went wrong; start that step over
Restore conversationKeptRevertedThe code is fine but the chat went off track
Restore codeRevertedKeptUndo the edits but keep what Claude learned
Summarize from hereKeptCompressed from this point onA long debugging detour is filling the context
Summarize up to hereKeptCompressed before this pointKeep recent messages word for word, shrink the old ones

The two code options only appear when there are tracked file changes after the chosen point. After Restore conversation or Summarize from here, your original prompt comes back into the input box so you can edit and resend it.

How do I guide a summary?

Highlight a Summarize option with the arrow keys and type instructions in the "add context (optional)" row before pressing Enter. Pressing the option's number key summarizes at once without instructions. Summarizing does not touch files on disk, and the original messages stay in the session transcript.

What do checkpoints not capture?

ChangeRestored by /rewind?
Edits through Claude's file toolsYes
Shell commands on a file Claude had already editedYes
A file changed only by shell commands (for example rm, a formatter, a migration script)No
Your own edits outside Claude Code, or another session's editsNo, unless they touched the same files
Edits by most subagents, including background onesOnly for files Claude had already edited in your conversation
Symlinked or hard-linked filesNo; Claude Code skips them and warns
Database rows, deployed code, sent messagesNo; checkpoints cover local files only

The docs put it plainly: checkpoints are for quick, session-level recovery and do not replace version control.

A safe routine for risky changes

  1. Commit or stash first. A clean git state means git diff shows everything that changed, whatever made the change.
  2. Plan before editing. Press Shift+Tab to plan mode, or run /plan, so Claude proposes the approach before touching files.
  3. Work in small prompts. One checkpoint per step makes it easy to step back exactly one step.
  4. Isolate experiments. claude --worktree try-new-parser runs the session in a separate git worktree, so a failed idea never reaches your main checkout.
  5. Branch the conversation. To try another approach while keeping the original session intact, use /branch or claude --continue --fork-session.

Can I get back a conversation I cleared?

Within the same Claude Code process, yes. After /clear, the rewind menu shows an entry at the top labeled /resume <session-id> (previous session). Select it to resume the conversation from before the clear. It disappears when you exit or resume another session. Later, /resume still lists the old conversation.

FAQ

Is /undo different from /rewind?

No. /undo and /checkpoint are aliases of /rewind and open the same menu.

Why does double Esc clear my text instead of opening rewind?

With text in the prompt, double Esc clears it and saves it to history. Press it again on an empty prompt to open the rewind menu, then press Up afterwards to recall your draft.

Why did a rewind say no files were restored?

The snapshots for that checkpoint were probably removed by the retention cleanup. Raise cleanupPeriodDays if you need them longer, and use git for older history.

Does rewinding undo a git commit Claude made?

No. A commit is a shell command and lives in git. Undo it with git, for example by resetting or reverting the commit.

Sources

Checked against the official docs on November 17, 2026: Checkpointing, Interactive mode and Common workflows.

See every current command and shortcut in one reference.

Open the Claude Code Cheatsheet →