How to undo Claude Code changes
Claude Code works directly on your project files. When a request goes wrong, for example it changes more files than expected or breaks something that worked, you need a reliable way back. Here are the options and their limits.
1. Claude Code checkpoints: /rewind
With every request you send, Claude Code saves a checkpoint of the files it changes with its own editing tools. With /rewind (or pressing Esc twice) you pick a point in the conversation and restore the code, the conversation or both.
- It is instant and does not need git.
- It does not track files changed only by shell commands (for example
rm,mv, scripts or installs): those changes stay. - It does not see changes made outside that session, by hand or from another chat.
2. Git: the most solid safety net
- Before a big request, save the state:
git add -Aandgit commit -m "before Claude", orgit stash. - Afterwards, see what changed with
git statusandgit diff. - To roll back one file:
git restore path/to/file. Everything:git restore .and, for new files,git clean -nto preview, thengit clean -f.
Git also restores what shell commands touched, but only for files in the repository and only if you saved the state first.
3. A log of every change
The most convenient option is to have, for every request, the list of files touched with added and removed lines and the reason for the change, and to undo one file or the whole request after seeing what it affects.
How MyHeroStudio does it
MyHeroStudio logs every Claude Code change with the reason Claude gave, saves a hidden git restore point at every request (without touching your branches) and also flags changes made by shell commands. From the "Changed files" list you undo one file, the whole request or go back to before a request, after seeing what would break.
Download it free, forever, in the standard version (Free). If you like it, upgrade to Pro to get the most out of it. Windows 10 and 11.