Back to Blog

Claude Code rewind: undo edits with checkpoints, and what they miss

Alex Kim
5 min read
Claude Code rewind: undo edits with checkpoints, and what they miss

Last updated: November 24, 2026

TL;DR

Claude Code saves a checkpoint of your code before every prompt that starts a turn. To go back, run /rewind (or its alias /undo), or press Esc twice with the prompt empty, pick the prompt you want to return to, and choose to restore the code, the conversation or both. Checkpoints cover edits made by Claude's file editing tools. They don't cover a file only a shell command changed, edits you make outside Claude Code, or most subagent edits, so keep committing with Git. Everything below comes from Anthropic's checkpointing docs.

Open the rewind menu

Two ways in:

  1. Run /rewind, or /undo, which does the same.
  2. Press Esc twice when the prompt input is empty. If the prompt has text in it, the first double Esc clears it instead; the text goes to your input history, so Up brings it back. In vim mode, press Esc twice from NORMAL mode.

The menu lists the prompts you sent in the session. Select the one you want to act on.

Choose what to restore

OptionWhat happens
Restore code and conversationBoth go back to that point
Restore conversationThe conversation goes back; your current code stays
Restore codeFile changes are reverted; the conversation stays
Summarize from hereEverything after that point is compressed into a summary
Summarize up to hereEverything before that point is compressed; later messages stay
Never mindBack to the list, nothing changed

The two code options appear only when that checkpoint has tracked file changes to revert. After you restore the conversation, or summarize from here, the prompt you picked comes back into the input so you can edit it and send it again.

Rewind the conversation without the code when Claude went the wrong way but the files are fine. Rewind the code without the conversation when you want to keep what you both learned and try the change again.

Summarize instead of compacting everything

The two summarize options work like a targeted /compact: they free context without touching files on disk, and the original messages stay in the session transcript. To steer the summary, highlight a summarize option with the arrow keys and type instructions where the row reads add context (optional), then press Enter. Our /compact guide covers when to compact the whole session instead.

To try a different approach while keeping the original session as it is, branch it with /branch rather than rewinding.

What rewind can't undo

  • ๐Ÿš Files only a shell command changed. Once Claude has edited a file with its file tools, rewind also undoes later shell changes to that file. A file that only shell commands touched isn't tracked.
  • โœ๏ธ Changes made outside the session. Your own edits in an editor and edits from other sessions running at the same time aren't captured, unless they touch files this session edited.
  • ๐Ÿค– Most subagent edits. Rewind restores only files Claude had already edited in your conversation. A subagent's edits to other files stay, background forked skills included. A forked skill running in the foreground is the exception. Our subagents guide covers how they run.
  • ๐Ÿ”— Symlinked and hard-linked files. A restore skips them and warns that it skipped files; they keep their current contents.
  • โณ Old checkpoints. A session keeps file snapshots for its 100 most recent checkpoints, and snapshots are cleaned up by default about 30 days after the session last saved one. Rewinding to a checkpoint whose snapshots are gone can fail with "No files were restored". The cleanupPeriodDays setting keeps them longer.

Rewind is not version control

Checkpoints are for quick recovery inside a session; Anthropic's docs say to keep using Git for commits, branches and long-term history. Commit before a large change so you can always get back, whatever made the edits. Our beginner's guide to GitHub source control covers the basics.

Two details save confusion later. Checkpoints are saved with the conversation, so /rewind still works after you resume a session. And if you rewind and then exit before sending another prompt, the rewound messages can come back: send a prompt before you exit so the rewound conversation is saved.

Frequently asked questions

How do I undo changes in Claude Code?

Run /rewind, or its alias /undo, or press Esc twice with an empty prompt. Pick the prompt you want to return to and choose Restore code, Restore conversation, or both.

Does Claude Code rewind undo shell commands?

Only for files Claude had already edited with its file editing tools. A file that only shell commands changed isn't tracked, so revert it with Git.

Can I rewind after resuming a Claude Code session?

Yes. Checkpoints are saved with the conversation, so /rewind works after you resume. Snapshots are cleaned up by default about 30 days after the session last saved one.

Does rewinding restore subagent edits?

Usually not. Rewind restores files Claude had already edited in your conversation; a subagent's edits to other files stay. A forked skill that runs in the foreground is the exception.

Are checkpoints a replacement for Git?

No. Checkpoints are for quick recovery within a session. Keep using Git for commits, branches and history.

Next: the commands around it

Rewind is one of a handful of commands that cover a working day. Our Claude Code CLI guide lists the rest, from starting and resuming a session to switching permission modes.

#claude-code#Rewind#Checkpoints#Git#ai-agents
Free assessment

Stop guessing. Score your first workflow.

Score one workflow in about five minutes. Nine questions, a grade, and the specific gap holding it back - no call required.