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:
- Every prompt you send that starts a turn creates a checkpoint of the code as it was.
- File snapshots are kept for the 100 most recent checkpoints in a session.
- Checkpoints are saved with the conversation, so
/rewindworks after you resume a session. - Snapshots are cleaned up with the rest of your session data, by default about 30 days after the session last saved one. The
cleanupPeriodDayssetting changes that.
What are the rewind options?
| Option | Code | Conversation | Use when |
|---|---|---|---|
| Restore code and conversation | Reverted | Reverted | The last attempt went wrong; start that step over |
| Restore conversation | Kept | Reverted | The code is fine but the chat went off track |
| Restore code | Reverted | Kept | Undo the edits but keep what Claude learned |
| Summarize from here | Kept | Compressed from this point on | A long debugging detour is filling the context |
| Summarize up to here | Kept | Compressed before this point | Keep 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?
| Change | Restored by /rewind? |
|---|---|
| Edits through Claude's file tools | Yes |
| Shell commands on a file Claude had already edited | Yes |
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 edits | No, unless they touched the same files |
| Edits by most subagents, including background ones | Only for files Claude had already edited in your conversation |
| Symlinked or hard-linked files | No; Claude Code skips them and warns |
| Database rows, deployed code, sent messages | No; 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
- Commit or stash first. A clean git state means
git diffshows everything that changed, whatever made the change. - Plan before editing. Press
Shift+Tabto plan mode, or run/plan, so Claude proposes the approach before touching files. - Work in small prompts. One checkpoint per step makes it easy to step back exactly one step.
- Isolate experiments.
claude --worktree try-new-parserruns the session in a separate git worktree, so a failed idea never reaches your main checkout. - Branch the conversation. To try another approach while keeping the original session intact, use
/branchorclaude --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.