Claude Code Checkpoints

Claude Code saves a checkpoint of your files before every prompt, so /rewind or Esc pressed twice can restore the code, the conversation or both to an earlier point. Checkpoints cover Claude's own file edits, not changes made only by shell commands or most subagents, so Git is still needed.

To undo changes in Claude Code, run /rewind or press Esc twice on an empty prompt, pick the prompt you want to go back to, and choose Restore code and conversation, Restore conversation or Restore code (Checkpointing). This works because Claude Code takes a checkpoint, a snapshot of the files it is tracking, before every prompt that starts a turn. Checkpoints are saved with the conversation, so rewinding still works after you close Claude Code and resume the session. They have limits worth knowing before you rely on them: a file changed only by a shell command (a formatter, sed, a code generator) is not restored, edits made by most subagents are not either, and snapshots are deleted after about 30 days. Anthropic's own advice is that checkpoints are for quick recovery within a session and are no replacement for Git. Checkpoints and /rewind arrived with Claude Code 2.0 on Sep 29, 2025.

Quick facts

Open the rewind menu /rewind, or Esc Esc on an empty prompt
When a checkpoint is made Before each prompt that starts a turn
Snapshots kept The 100 most recent checkpoints in a session
Kept for About 30 days after the session's last snapshot (cleanupPeriodDays)
Survives resume Yes
Tracks Claude's file edits, and later shell changes to files Claude already edited
Does not track Files changed only by shell commands, most subagent edits, outside edits, symlinks
Added Claude Code 2.0, Sep 29, 2025

Sources: Checkpointing, Claude Code Docs, read Nov 6, 2026; Claude Code changelog, Sep 29, 2025.

How do I rewind in Claude Code?

  1. Run /rewind, or press Esc twice while the prompt is empty. (With text in the prompt, Esc twice clears it instead; the text is saved in history, so Up brings it back.)
  2. The menu lists the prompts you sent in this session. Choose the one to go back to.
  3. Choose an action:
    • Restore code and conversation: both go back to that point.
    • Restore conversation: the chat goes back, your files stay as they are.
    • Restore code: the files go back, the conversation stays.
    • Summarize from here: everything after this point is replaced by a summary, to free context.
    • Summarize up to here: everything before this point is summarized, later messages stay.
    • Never mind: back to the list, nothing changed.

Source: Checkpointing, read Nov 6, 2026.

The two code options appear only if that checkpoint has file changes to undo. After restoring the conversation or summarizing from a point, the original prompt reappears in the input box, ready to edit and send again, which is the usual way to retry a request with better wording. In the VS Code extension the same choices sit on each message: hover over it to rewind the code, fork the conversation, or both (Claude Code in VS Code and JetBrains).

Summarizing instead of rewinding

The two summarize options change no files. They work like a targeted /compact: the chosen stretch of conversation is compressed into a summary, a "Summarized conversation" marker shows where, and the original messages stay in the session's transcript (Checkpointing). To steer the summary, highlight a Summarize option with the arrow keys, type instructions where the row reads "add context (optional)" and press Enter. Summarizing from a midpoint suits a long debugging session: the opening instructions stay word for word, and the trial and error after them shrinks to a paragraph. For managing context in general, see Claude Context Window.

What checkpoints do not cover

Anthropic lists the gaps plainly (Checkpointing):

  • Shell commands. A file that only a shell command changed is not tracked and stays as it is. Once Claude has edited a file with its own tools, later shell changes to that file are rewound too.
  • Subagents. Edits by a subagent are usually not captured. Only a skill forked to run in the foreground edits within your own turn; any other subagent's changes to files Claude had not already edited stay after a rewind, including a background /code-review --fix.
  • Outside changes. Edits you make in your editor, or another Claude Code session makes, are not captured unless they touch files this session also changed.
  • Messages sent mid-turn. A message typed while Claude was working may show "No code restore"; rewind to the prompt that started that turn instead.
  • Symbolic and hard links. Restores skip them with a "Restored the code, but skipped N files" warning, which affects dotfile managers and pnpm.
  • Age. Snapshots older than about 30 days are deleted, and rewinding to one can fail with "No files were restored"; raise cleanupPeriodDays to keep them longer.
  • Side effects. A rewind restores files, not the world: a database migration that ran, a package that was published or a commit that was pushed stays done.

Anthropic's conclusion is that checkpoints are "not a replacement for version control". Commit before letting Claude loose on something large, or work in a Git worktree (Claude Code Desktop has a toggle for one), and use permission modes to keep Claude from running commands with lasting effects unasked.

Rewind, branch and resume

Rewinding stays in the same session. To try a different approach while keeping the original intact, /branch creates a branch of the conversation at the current point, and claude --continue --fork-session does the same from the shell (Checkpointing, Commands). If you ran /clear earlier, the rewind menu shows an extra first entry, /resume <session-id> (previous session), to return to the conversation before the clear, as long as Claude Code has not been closed. One quirk: if you rewind and then quit before sending another prompt, the rewound messages can come back on resume, because Claude Code saves the rewound conversation with your next prompt.

Frequently asked questions

How do I undo Claude Code changes? Press Esc twice on an empty prompt or run /rewind, pick the prompt to go back to, and choose Restore code (files only) or Restore code and conversation.

Does Claude Code rewind undo shell commands? No. Claude Code checkpoints restore files Claude edited with its own tools; files changed only by shell commands, and side effects such as migrations or pushes, are not undone, so use Git for those.

How long does Claude Code keep checkpoints? Claude Code keeps snapshots for the 100 most recent checkpoints in a session and deletes them about 30 days after the session last saved one, a period set by cleanupPeriodDays.

Do Claude Code checkpoints work after closing the session? Yes. Checkpoints are saved with the conversation, so /rewind works after resuming a Claude Code session with /resume or claude --continue.

Is /rewind the same as git reset? No. Claude Code's /rewind only restores the files it tracked in that session and leaves Git history alone; git reset changes the repository's commits and can undo work Claude did not track.

Can I rewind in the Claude Code VS Code extension? Yes. In the Claude Code VS Code extension, hover over a message to rewind the code, fork the conversation from there, or both.

Sources

Moments

Claude Code best practices | Code w/ Claude

Anthropic

  1. To undo changes in Claude Code, run /rewind or press Esc twice on an empty prompt, pick the prompt you want to go back…

See also

About this page

Last updated Nov 6, 2026 by the Vi.ki team. Page text CC BY-SA 4.0.

Edit History

Hotkeys

/
Jump to the search box
? or Ctrl + /
Open this list
Esc
Close this list, the photo viewer, or the account menu

Video

Space or K
Play or pause
← →
Back or forward 5 seconds
J L
Back or forward 10 seconds
0 to 9
Go to 0% to 90% of the video
, .
Previous or next frame, while paused
M
Mute or unmute
C
Captions on or off
F
Full screen on or off
A D
Previous or next moment

Photo viewer

← → or A D
Previous or next photo
↑ ↓ or W S
Previous or next photo
Home End
First or last photo
I
Show or hide the photo's info
Z
Clickless on or off: a pointer over a thumbnail shows it
N
Compare with the last photo: back to the one shown before this, and N again comes back
Q
Move the thumbnails to the next edge: top, bottom, left and round
, or Ctrl + ,
Open or close the viewer's settings
V
Clickless pan: a zoomed photo follows the pointer, rather than being dragged
Shift
Browse on or off
B
Show or hide the button bar
T
Show or hide the thumbnails
1
100% zoom on or off
0
Rate the photo as no opinion; again takes the answer back
+ -
Rate the photo a step higher or lower
F
Full screen: the photo alone. F again puts everything back.
Back to top