Claude Code for beginners: restore code or conversation with /rewind
A code change went wrong, but the conversation still contains useful instructions. With /rewind in Claude Code, you can restore file changes without losing the chat. You can also do the reverse, or restore both.
This is a documentation-verified micro-guide, not a recorded test run. The visuals are illustrations.
Restore the right part with /rewind
You need Claude Code installed and signed in, with an existing session containing earlier messages. If you are starting from scratch, follow the official Claude Code quick start first.
- Type
/rewindin Claude Code's input field. You can also press Esc twice when the field is empty. - Select the prompt that started the turn you want to undo. A checkpoint captures the state before that turn. A message sent while Claude was working may not have its own code checkpoint.
- Choose one option: Restore code reverts tracked file edits and keeps the conversation. Restore conversation rewinds the chat and keeps your code. Restore code and conversation restores both.
- Check the files and chat before continuing. If you restored the conversation, send another prompt before exiting the session. Otherwise, removed messages can return when you reopen it. Restored files are not affected by that limitation.
Code options appear only when the selected checkpoint has tracked changes to revert. If they are absent, do not choose a different action expecting it to restore files anyway.
Source: Claude Code: Checkpointing.
What restoration does not promise
Here, tracked means Claude Code captured the file through its editing tools in the conversation, not that Git tracks it. A file changed only through shell commands is not restored. Later shell changes to an already tracked file can be reverted.
Edits by other agents or concurrent sessions are not generally covered. For other subagents, only already tracked files are normally restored; a foreground forked skill is a documented exception. Symbolic and hard links are skipped. Older checkpoints may also have lost their stored snapshots.
Keep Git for permanent version history. Try the choice between code and conversation in a separate practice project, then review the result. It is a useful habit to teach when a team starts working with coding agents.
The Forge newsletter
Get new articles in your inbox
Pick the topics you care about. No noise, at most one email a week.
We follow GDPR. Unsubscribe anytime.