Claude Code Rewind: Undo Claude’s Changes With /rewind

Claude has just rewritten three files in a direction you didn’t want, and you’d like the last five minutes back. You don’t need to pick through a Git diff. Claude Code saves a checkpoint before every prompt, and the Claude Code rewind menu lets you jump back to any of them, restoring your files, the conversation, or both. Here’s how it works and where its limits are.

How checkpoints work

Every time you send a prompt that starts a new turn, Claude Code records a checkpoint. It keeps track of the files Claude edits through its own editing tools during that turn, so it can put them back the way they were. Checkpoints belong to the session and survive if you close Claude Code and come back with --resume.

There’s nothing to set up. Checkpointing is on by default.

Opening the rewind menu

There are two ways in:

  • Type /rewind (or its alias /undo)
  • Press Esc twice while the prompt box is empty

If you’ve typed something, a double Esc clears the box instead. The text isn’t lost, it goes to your input history, and the Up arrow brings it back. In vim mode, press Esc twice from normal mode.

The menu lists your earlier prompts. Pick the point you want to go back to, and you’ll get a set of choices.

The restore options

Restore code and conversation puts both back. Your files return to how they were before that prompt, and the conversation is cut back to the same point. Use this when a whole line of work went wrong.

Restore conversation rewinds the chat but leaves your files as they are now. This is useful when the code is fine but the conversation has wandered, and you want Claude to pick up from an earlier point with less clutter in its context.

Restore code puts the files back but keeps the conversation. Claude still remembers what it tried, which helps if you want to say “that approach didn’t work, try another one”.

Summarize from here and Summarize up to here don’t touch your files. They compress part of the conversation into a summary to free up context, and you can add a note to steer what the summary keeps. They’re a more targeted version of /compact, which Claude Code context: /compact, /clear and CLAUDE.md explains.

Never mind closes the menu. After a restore, your original prompt goes back into the input box, so you can edit it and send it again.

If a checkpoint had no file changes, the two code options don’t appear. If you’d rather keep the current path and explore another one, /branch forks the conversation instead of rewinding it.

What rewind can’t undo

This is the part to understand before you rely on it. Checkpoints track Claude’s own file edits, not everything that happens on your machine:

  • Files changed only by shell commands aren’t tracked. If Claude ran rm, mv, a code generator or a database migration through Bash, rewind can’t reverse it. If Claude had already edited a file with its edit tools, later Bash changes to that same file are undone
  • Edits made by subagents generally aren’t restored
  • Your own edits in an editor, and changes from another Claude session, aren’t captured unless they touch files Claude was also tracking
  • Symlinked and hard-linked files are skipped, and Claude Code warns you when it skips them
  • Anything outside your files, such as a pushed commit, a deployed build or an API call, is gone for good

If you send a message while Claude is still working, it can be marked as having no code restore. Rewind to the prompt that started that turn instead.

How long checkpoints last

Claude Code keeps file snapshots for the 100 most recent checkpoints in a session. Old snapshots are cleaned up about 30 days after the session last saved one, controlled by the cleanupPeriodDays setting. If you rewind to a checkpoint whose snapshots have gone, you’ll see No files were restored.

Rewind is not version control

Checkpoints are a quick undo for the current session, not a history of your project. Keep using Git alongside them:

  • Commit before you ask Claude for anything large, so you always have a clean point to return to
  • Use a separate branch or worktree for experiments. Git worktrees vs branches shows how to give each agent its own copy
  • If you’ve already committed Claude’s work, how to undo the last Git commit covers reset, revert and amend

For the shell commands rewind can’t reverse, prevention works better than cure. Claude Code permission modes let you approve risky commands before they run, and Claude Code hooks can block them outright.

Quick reference

  1. Open the menu with /rewind or Esc twice on an empty prompt
  2. Pick the prompt to return to
  3. Choose code and conversation, conversation only, or code only
  4. Remember Bash changes and subagent edits aren’t covered
  5. Commit with Git before big changes anyway

Leave a Reply