Use code DEC25: 25% off all 85 Claude Code agents, for $29.25 instead of $39Get access →
Coding·Updated ·5 min read

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

  1. With the prompt empty, press Esc twice, or type /rewind. (In vim mode, press Esc twice from NORMAL mode.)
  2. Pick the earlier prompt you want to go back to.
  3. Choose what to restore (see the table below).
  4. 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

Claude Code /rewind options
OptionCodeConversationUse it when
Restore code and conversationRolled backRolled backThe whole attempt was wrong. Start that step again.
Restore conversationKeptRolled backThe code is fine, but the chat went off track.
Restore codeRolled backKeptYou want the files back but Claude should remember what it learned.
Summarize from hereKeptLater messages summarizedA long tangent is filling the context window.
Summarize up to hereKeptEarlier messages summarizedThe 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, mv or 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

  1. Commit before a big task. git commit gives you a restore point that nothing can delete.
  2. Plan first with plan mode, so fewer attempts need undoing.
  3. Use /rewind for quick rollbacks within a session.
  4. Use `git diff` and `git restore` for anything checkpoints don't cover, like files a script generated.
  5. 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

Keep reading