6 min · +100 XP
Roll back a change
Stop Claude, go back to an earlier point, and know what cannot be undone.
By the end of this lesson
You will be able to stop Claude and return your files and conversation to an earlier point.
Claude Code remembers the state of the files it edits before each of your messages. So when a change goes wrong, you can go back to the moment before it. This lesson shows how, and where this safety net ends.
Stop first
- 1Press Esc while Claude is working. It stops the current action and keeps what it has done so far.
- 2Then say what to do instead, or ask Claude to reverse its last change with the phrase below.
“Undo your last change and tell me which files you put back.”
Claude reverses its own edit. For an exact return to an earlier point, use /rewind below.
Go back with /rewind
- 1Make sure the prompt is empty, then press Esc twice quickly. Or type /rewind and press Enter.
- 2(If there was text in the prompt, the first double Esc clears it; press Up later to get it back.)
- 3A list of the messages you sent in this session appears. Use the arrow keys to choose the point to go back to, and press Enter.
- 4Choose what to restore from the list of options, shown below.
Which option to choose
- 1Restore code and conversation: the attempt went wrong and you want to try again from that point, as if it never happened.
- 2Restore code: undo the file changes, but keep the conversation, so Claude remembers what did not work.
- 3Restore conversation: the files are fine, but the conversation went off track.
- 4Summarize from here or up to here: compress part of a long conversation to free space in the context window; files are not changed.
- 5The code options appear only if Claude changed files after that point.
Files changed only by shell commands (for example, deleted or moved by a command) are not tracked. Neither are your own edits made outside Claude Code, or edits from another session. Anything that left your files, such as a sent message or a change in an online service, cannot be rewound at all. Checkpoints are a quick undo for the current session and do not replace Git.
Before a risky change
“Commit everything now with a clear message, then start the change.”
Git keeps this snapshot regardless of how the files are changed later.
“Go back to the last commit. First tell me what I will lose.”
Claude returns the files to the snapshot, after showing you what will be thrown away.
Checkpoints are saved with the conversation, so /rewind still works after claude --resume; snapshots are kept for the 100 most recent checkpoints and swept after about 30 days (cleanupPeriodDays). Subagent edits are usually not captured, so rely on Git for those. To try another approach while keeping the original session intact, use /branch. When summarising, highlight the option and type instructions where the row reads "add context (optional)" to guide the summary.
A safe practice terminal. Claude just made the buttons bigger, and now the totals are broken. Roll back to the moment before that request.
1Open the rewind menu: type /rewind
Claude ran a command that deleted three old images it had never edited. Can /rewind bring them back?
Claude rewrote your page, and you prefer the old version, but you want Claude to remember why the new one was wrong. Which option?
Facts checked against the official Claude Code docs October 24, 2026 · source

Author
Evgenii Arsentev
PhD · Chief Executive Officer, digital health