Save points for AI coding with /branch and /undo
Published · Updated

Short answerType /branch and a name to copy the conversation and experiment. Type /undo, or press Esc twice on an empty prompt, to rewind the code, the chat or both. It only tracks files Claude edited, so keep using git.
A video game has save points. Your AI coding session can have them too.
Try a risky idea: /branch
/branch try-redis
You get a copy of the conversation to experiment in. Your first conversation stays untouched, and you can come back to it any time with /resume.
Made a mess? /undo
/undo
/undo is the same as /rewind. Pick a point to go back to.
Shortcut: press Esc twice on an empty prompt to open the same menu.
What you can restore
- The code and the conversation.
- Only the conversation.
- Only the code.
- Or summarise part of the chat to free up space.
The catch
It only tracks files that Claude edited. A file changed only by a shell command, such as a sed or a build script, is not covered. It also keeps checkpoints for a limited time. This is not a replacement for git, so commit your real work.
A safe habit
Before you ask for a risky change, commit your work in git. Then use /branch for the experiment. If the idea works, keep going. If not, /undo back or /resume your first conversation, and your commit is still there as a second safety net.
Because only files Claude edited are tracked, ask Claude to make the risky edits itself rather than through a script when you want them to be undoable.
More quick tips
More prompts on this topic
- Safe science experiment for kidsChatGPT · Gemini · Claude
- Resolve a Git merge conflict safelyClaude · ChatGPT · Claude Code
- Write a CLAUDE.md file for your projectClaude Code · Cursor



Comments
No comments yet. Be the first to share what worked for you.