Undo what Claude Code did with /rewind
Claude edited the wrong files, or went down a path you do not want. Claude Code keeps checkpoints as you work, so you can step back without hunting through your files. It has limits, and it is worth knowing them before you need it.
How checkpoints work
- Every prompt you send that starts a turn creates a checkpoint of your code from before that turn.
- Claude Code tracks changes made by its own file-editing tools.
- It keeps file snapshots for the 100 most recent checkpoints in a session.
- Checkpoints are saved with the conversation, so
/rewindstill works after you resume a session. - Snapshots are cleaned up by default about 30 days after the session last saved one. The
cleanupPeriodDayssetting changes that.
Open the menu
Type /rewind, or press Esc twice when the prompt box is empty. If the box has text in it, a double Esc clears the text instead, and you can bring it back with the Up arrow. The menu lists the prompts you sent in this session. Pick the point you want, then pick an action.
The actions
- Restore code and conversationReverts both to that point.
- Restore conversationRewinds the chat to that message and keeps your current code.
- Restore codeReverts the file changes and keeps the conversation.
- Summarize from hereCompresses the conversation from that point on into a summary, which frees space in the context window.
- Summarize up to hereCompresses the part before that point and keeps the later messages.
- Never mindGoes back to the list without changing anything.
The two code options only appear when the chosen checkpoint has tracked file changes. After a restore or "Summarize from here", the original prompt returns to the input box so you can edit it and send it again.
Summarizing does not touch your files, and the original messages stay in the session transcript. To steer the summary, highlight a Summarize option and type instructions where it says "add context (optional)". If you ran /clear earlier in the same Claude Code process, the menu also shows a /resume entry at the top for the session from before the clear.
When it is useful
- You want to try a second approach without losing your starting point.
- A change introduced a bug and you want it gone.
- A long debugging session is eating context and you want to compress the middle. See spend less of your quota.
To branch off and try something different while keeping the original session whole, the documentation points to /branch or claude --continue --fork-session instead of rewinding.
What it cannot undo
- Changes only a shell command made. If Claude had already edited a file with its editing tools, rewind also undoes later shell changes to that file. A file that only shell commands changed is not tracked. Use git.
- Most subagent edits. Rewind restores only the files Claude had already edited in your conversation. A subagent's edits to other files stay. Use git.
- Changes from outside. Edits you make by hand outside Claude Code, and edits from other sessions running at the same time, are normally not captured.
- A message you typed while Claude was working can be marked "No code restore". To undo those edits, rewind to the prompt that started the turn.
- Symlinks and hard links. Claude Code skips them and shows a "skipped" warning. Ask Claude to reverse the edit, or edit the file yourself.
It is not version control
The documentation says checkpoints are for quick recovery inside a session. For history you can rely on, and for working with other people, keep committing to git. A good habit is to commit before you start something big.
Try it on something harmless
- In a scratch folder, ask Claude to create a small file.
- Type
/rewind, choose the prompt, and choose "Restore code". - Check that the file is gone and the conversation is still there.
This follows Anthropic's checkpointing documentation as we read it in October 2026. We are not affiliated with Anthropic. We wrote this from the documentation and have not tested every case.
See also: Claude Code sessions: resume, name, branch.
The free loop-stop skill gives long tasks a limit and a stop rule. If you want a second pair of eyes on your CLAUDE.md and settings, the Tune-Up Kit is a checklist for exactly that.