Claude Code /rewind: How to Undo Changes With Checkpoints
By Shubhranshu, creator of claudeagents · Last reviewed
To undo Claude Code's changes, press Esc twice with an empty prompt or type /rewind (also /undo). Pick the prompt you want to go back to, then choose to restore the code, the conversation, or both. Claude Code saves a checkpoint automatically before every prompt, so there's nothing to set up.
Checkpoints make it safe to let Claude try something bold: if it goes wrong, you're one menu away from where you started. But they don't track everything, so it's worth knowing the gaps before you rely on them.
Facts in this guide are from the Claude Code checkpointing docs, checked on 4 December 2026.
How to undo changes in Claude Code
- With the prompt empty, press Esc twice, or type
/rewind. (In vim mode, press Esc twice from NORMAL mode.) - Pick the earlier prompt you want to go back to.
- Choose what to restore (see the table below).
- Your original prompt comes back into the input box, so you can edit it and try again.
If you have text in the prompt, double Esc clears it instead of opening the menu. Clear it first.
The rewind options explained
| Option | Code | Conversation | Use it when |
|---|---|---|---|
| Restore code and conversation | Rolled back | Rolled back | The whole attempt was wrong. Start that step again. |
| Restore conversation | Kept | Rolled back | The code is fine, but the chat went off track. |
| Restore code | Rolled back | Kept | You want the files back but Claude should remember what it learned. |
| Summarize from here | Kept | Later messages summarized | A long tangent is filling the context window. |
| Summarize up to here | Kept | Earlier messages summarized | The early part of the session is no longer needed. |
The code options only appear when that checkpoint has file changes. Summaries never change files on disk.
Restore code is the underrated one: Claude keeps the knowledge of why the first try failed, so the second try is usually better.
What checkpoints don't track
Checkpoints track edits made with Claude's own file-editing tools. These are not covered:
- Shell commands that create, move or delete files Claude hasn't edited with its tools, such as
rm,mvor a code generator. - Most subagent edits. Changes made by subagents generally aren't checkpointed.
- Symlinked or hard-linked files. They're skipped, with a "skipped N files" warning.
- Your own edits in an editor. If you change a file Claude also edited, restoring can overwrite your change.
Snapshots are kept for the 100 most recent checkpoints in a session and deleted about 30 days after the session last saved one (raise this with cleanupPeriodDays). If they're gone, the menu reports "No files were restored".
A safe undo routine
- Commit before a big task.
git commitgives you a restore point that nothing can delete. - Plan first with plan mode, so fewer attempts need undoing.
- Use /rewind for quick rollbacks within a session.
- Use `git diff` and `git restore` for anything checkpoints don't cover, like files a script generated.
- Block risky shell commands with permission rules or a hook, since their effects can't be rewound.
Fewer mistakes to undo
The best undo is the one you never need. claudeagents gives Claude Code 85 focused agents and 53 slash commands with tested instructions, so tasks like /write-tests or /fix-error follow a known path instead of improvising.
Frequently asked questions
How do I undo changes in Claude Code?
Press Esc twice with an empty prompt, or type /rewind (or /undo). Pick the prompt to go back to and choose Restore code, Restore conversation, or both.
Can I undo after closing Claude Code?
Yes. Checkpoints survive when you resume a session, for about 30 days by default. Resume the session with claude --resume and open /rewind.
Does /rewind undo bash commands?
No, not for files Claude only touched through shell commands, such as rm or mv. Use Git to recover those.
Is Claude Code checkpointing a replacement for Git?
No. Checkpoints are a local, short-term undo for a session. Commit to Git for permanent history and anything you share with others.
What's the difference between /rewind and /clear?
/rewind goes back to an earlier point and can restore files. /clear starts a fresh conversation without changing files; after /clear, the rewind menu offers a way back to the previous session.
Sources
Skip the setup: get the Coding kit
30 ready-made coding agents, 19 slash commands and 22 skills for Claude Code. $15 one-time, lifetime updates.
All 3 kits (Coding, SEO and Marketing): 85 agents for $39 instead of $45. See what's in the Coding kit
Use code for 25% off all 3 kits: pay $29.25 instead of $39
Valid until Dec 19 · enter it at checkout