turnslip

How to undo Claude Code changes

Last updated: 8 October 2026

Claude Code changed something you did not want: a file rewritten, a file deleted by rm, a dependency installed. There are three ways back, and each one restores different things. This page says what each one covers, so you can pick the right one before you need it. If files are already gone, start with Claude Code deleted my files.

1. Claude Code's own rewind

Claude Code keeps a checkpoint before each prompt that starts a turn. "Run /rewind, or press Esc twice when the prompt input is empty, to open the rewind menu", pick a message, then choose to restore the code, the conversation, or both (checkpointing).

What it does not cover, in the documentation's words: "Checkpointing does not track files modified by Bash commands." (checkpointing). For subagents: "Any other subagent: rewinding doesn't restore the edits", apart from a skill forked in the foreground (subagent edits). And "Checkpointing doesn't rewind symlinked or hard-linked files." Its own advice: checkpoints are "Not a replacement for version control".

A measured test on Claude Code 2.1.292 shows the line in practice: /rewind restored a Write edit and none of rm, mv, sed -i and npm install (What /rewind misses).

2. git

If you committed before you asked Claude for something, git can take the changed files back. Use git restore --staged --worktree . rather than plain git restore .: "By default, if --staged is given, the contents are restored from HEAD, otherwise from the index." (git restore), so a change Claude already staged is undone too. For new files, git clean -n lists what would go: "Don't actually remove anything, just show what would be done." (git clean).

Its limits:

3. turnslip

turnslip is a Claude Code plugin. It snapshots the project's files and compares them at the end of each turn (its README), so a file changed by a shell command counts as much as one Claude edited. One line under each reply says what changed; /turnslip:undo takes the last turn back. In a test on 7 October 2026 with Claude Code 2.1.292, one turn changed a file with sed -i and deleted another with rm, and the undo put both back:

The same prompt in a real terminal (WezTerm), recorded 8 October 2026 with Claude Code 2.1.293 and turnslip 0.3.9; the wait while Claude works is sped up 2.5 times. No sound.

Its limits, said plainly:

Which one to use

Commit before a big request, whatever else you use. For a quick step back in the same session, /rewind also rewinds the conversation. When Claude runs commands, and you want to see what changed before you decide, turnslip covers the shell changes /rewind leaves out. They work side by side.

Related: What did Claude Code just change? · What /rewind misses: a measured test · All guides · Install turnslip, free