Claude CodeClaude Code 2.1 · macOS, Linux, Windows
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
31 small wins to finish your pathNext lesson

Undo: rewind and checkpoints

Before Claude edits a file, it saves what was there. That is what makes it reasonable to let it try something.

A checkpoint is captured at every prompt you send, not at every edit, and Claude Code keeps the file snapshots for the hundred most recent checkpoints in a session. They are saved with the conversation, so they still work after you resume a session tomorrow.

The rewind menu

In the session
Type /rewind, or press Esc twice while the input is empty. If there is text in the input, a double Esc clears that instead, and the cleared text goes into your input history so Up brings it back.

The menu lists every prompt you sent in the session. Pick a point, then pick what to do with it.

ChoiceWhat it does
Restore code and conversationBoth go back to that moment
Restore conversationThe chat goes back, your files stay as they are
Restore codeThe files go back, the conversation stays
Summarize from hereCompress everything after that point into a summary
Summarize up to hereCompress everything before it, keep the recent messages

The two restore-code options only appear when that checkpoint actually has file changes to undo. The separation is the useful part: undoing the code while keeping the conversation lets you say that approach was wrong, try the other one without re-explaining the problem.

The part that catches people

Checkpoints cover the file editing tools. They do not cover what a shell command did. If Claude ran a script that rewrote a file, or a migration, or git checkout, rewinding will not put any of that back.

Commands are not covered
Two consequences. Keep using git, because checkpoints are not a version control system and they only reach files Claude edited directly. And treat commands differently from edits when you decide what to allow, which is the whole subject of lesson 16.

There is also a quieter limit worth knowing: snapshots are swept after about thirty days by default, so rewinding a very old session can find the conversation intact and the files gone.

Try it yourself
  • Ask for a change you do not want, then rewind the code and keep the conversation.
  • Open /rewind in a long session and read the list of your own prompts. It is a good record of how the work actually went.

Little by little, you're building something great.