Undo without fear
By the end of this lesson you will have broken something on purpose and put it back, using two keys. You will also know the four things this undo does not cover, which is the more important half: an undo you trust too much is worse than no undo at all.
The reason people drive Claude Code one careful prompt at a time is fear. Not of the tool, but of the moment where it confidently rewrites six files and you cannot remember what three of them used to say.
That fear is reasonable and it is also solvable. Every prompt you send saves a checkpoint. You can go back to any of them.
Break something
Go back to the folder from lesson 1 and start a session.
Pick the session from lesson 1.
claude --resumeNow ask for something you do not want:
Rewrite card.html completely as a dark-mode terminal aesthetic with a monospace font and no headings.Let it finish. Open the page and look at it. Assume you hate it.
Put it back
Press Esc twice on an empty prompt. Not while you are mid-sentence: if there is text in the box, a double Esc clears the text instead, and saves your draft to history so Up gets it back.
Same thing as pressing Esc twice on an empty prompt. Use whichever you remember.
/rewindYou get a list of checkpoints, one per prompt you sent, and six choices:
- Restore code and conversation — everything goes back, files and chat both
- Restore conversation — the chat rewinds, the files stay as they are
- Restore code — the files rewind, the chat remembers what happened
- Summarize from here — keep going, but compress everything after this point
- Summarize up to here — keep going, but compress everything before it
- Never mind — back out
Pick Restore code and conversation at the checkpoint before your dark-mode request. Open the page again. It is the one you liked.
The two code options only appear when that checkpoint changed files. A checkpoint where you only asked a question has nothing to restore.
Checkpoints are saved with the conversation, so this works after a resume too. Yesterday's mistake is still undoable this morning. The last 100 checkpoints in a session keep their file snapshots, and everything is deleted along with the session after 30 days.
What it does not cover
This is the half that matters, and it is why the official documentation says, in as many words, that this is not a replacement for version control.
Four things rewind cannot bring back:
- Files changed by a shell command. If Claude ran
rm,mvorcp, those changes are not tracked and not reversible. This is the big one. A deleted file is deleted. - Edits made by a subagent. You will meet subagents in module 4. Their changes are not restored by a rewind.
- Changes made outside the session. Your own edits in another editor, or edits from a second Claude session running at the same time, are invisible to it.
- Symlinked and hard-linked paths. These are skipped, and you get a note saying how many files were passed over.
So the honest rule for the rest of this course, and it becomes load-bearing the moment you have more than one session running:
Rewind is for the last ten minutes. Git is for everything else.
Commit before you start something ambitious. It costs one command and it is the only undo that covers all four of the cases above.
git add -AIf this folder is not a repository yet, run git init first. Module 3 needs one anyway.
git commit -m 'before the rewrite'I-check ito
- You asked for a change you did not want, and the file changed
- A double
Escon an empty prompt opened the checkpoint list - Restoring code and conversation put the file back to the version you liked
- You can name at least two things rewind will not undo
- The folder is now a git repository with at least one commit in it
Kung makikita mo Esc Esc just clears what I was typing
There was text in the prompt box. Clear it first, then press Esc twice on the empty box. Your cleared draft is not lost, press Up to bring it back. Or skip the keys entirely and type /rewind.
Kung makikita mo The rewind menu has no 'Restore code' option
That checkpoint did not change any tracked files, so there is no code to restore. Pick an earlier one, or check whether the change was made by a shell command rather than a file edit, in which case it was never tracked.
What you just learned
- Every prompt creates a checkpoint.
Esctwice on an empty box, or/rewind, opens the list. - You can restore code, the conversation, or both, and checkpoints survive resuming a session tomorrow.
- Shell-command file changes, subagent edits and outside edits are not tracked and cannot be rewound.
- Rewind covers the last few minutes. Git covers the rest, and one commit before ambitious work makes the difference.
pagsasanay
Buksan ang Claude Cowork sa sarili mong computer at subukan ito sa totoong mga file. Nagtatapos ang bawat module sa isang checkpoint kung saan isusumite mo ang ginawa mo.
Buksan sa ClaudeSusunod
Module 1 recap