Undo a Claude Code mistake, and what rewind misses

A two-minute checklist to run before any big job, so one wrong move is never permanent.

1. Before a big jobClient filesClient files copyYour way back, whatever Claude tracked.
2. If it goes wrong/rewind
  • Restore codeFiles back, chat kept
  • Restore conversationChat back, files kept
3. Rewind will not bring back
  • Command changesFiles only a command moved or deleted
  • Helper editsMost edits by helper agents
  • Outside editsMade by you or another session
So the copy matters.
  1. Before a big job, copy the folder. The copy is separate from anything Claude Code tracked, so it is your way back.
  2. If Claude goes wrong, type /rewind and pick what to restore: the code, the conversation, or both.
  3. Rewind does not bring back three things: files that only a command changed, most edits made by helper agents, and changes made outside the session. That is why the copy matters.
10 minNo code

You need

  • Claude Code
  • A folder you want to protect

You ask Claude Code to tidy a folder of client files. Halfway through, you see it rewrote the wrong ones.

Claude Code has an undo button, called rewind. It fixes a lot. It does not fix everything, and finding that out after the damage is too late. This guide shows you how to use rewind, the three things Anthropic's docs say it does not bring back, and the habit that covers the gaps: copy the folder before any big job.

01 / 06

Before a big job: copy the folder

A copy is a separate folder, so it does not depend on what Claude Code tracked. Make it before you start. Pick the one that fits you.

Mac or Linux (Terminal):

Mac or Linux
copy-mac.txt
cp -R "Client files" "Client files copy 2026-11-08"

Windows (PowerShell), the safe version:

Windows, safe version
copy-windows.txt
robocopy "Client files" "Client files copy 2026-11-08" /E

Robocopy finishes with exit code 1 when it has copied files (PowerShell shows it with echo $LASTEXITCODE). That is a success, not an error.

Windows (PowerShell), the plain version:

Windows, plain version
copy-windows-plain.txt
Copy-Item -Recurse -Path "Client files" -Destination "Client files copy 2026-11-08"

Run it once. If the destination folder already exists, PowerShell puts the copy inside it, one level too deep.

Or right-click the folder, choose Copy, and Paste. It is slower on big folders but needs no commands.

  1. Open the copy and check that hidden files (like .env) and sub-folders are inside.

  2. Open Claude Code in the original folder, not in the copy. The copy stays untouched.

  3. If you use Git, a commit is also a restore point: git add -A, then git commit -m "before big job". This includes any .env or key files in the folder, so keep that repository on your own computer and never push it.

02 / 06

If Claude goes wrong: use rewind

  1. Open rewind by typing /rewind, or press Esc twice when the prompt box is empty. If the box has text in it, double Esc clears the text instead.

  2. Pick the message you sent that started the job that went wrong. Rewind puts your files back as they were before that message.

  3. Choose what to restore. Anthropic's docs list three options: Restore code and conversation puts back both, Restore conversation rewinds the chat only and leaves the files as they are, and Restore code puts the files back and keeps the conversation.

  4. The two code options appear only when Claude's file edits were tracked after that message.

03 / 06

What rewind will not bring back

Anthropic's checkpointing page lists these limits. Read them before the job, not after.

  1. Files that only a command changed. Rewind tracks edits Claude makes with its own file editing tools. If Claude ran a command that deleted, moved or copied a file it never edited, rewind does not track it and the file stays changed. One detail from the docs: if Claude did edit a file first, rewind does undo a later command's change to that same file.

  2. Most helper-agent edits. If Claude hands part of the job to a helper agent (a subagent), those edits usually are not captured. The docs say a helper running in the background is a common case. Use Git or your copy.

  3. Changes made outside the session. Edits you make yourself, or that another Claude session makes, are normally not tracked.

Two more limits from the same page:

  • Linked files. Symlinks and hard links are skipped when you restore code, and Claude Code shows a warning.
  • Old snapshots. Claude Code keeps snapshots for the 100 most recent checkpoints in a session, and deletes a session's snapshots about 30 days after it last saved one, by default. This is the setting as of November 2026.

The docs also say checkpoints are for quick recovery inside a session and are not a replacement for version control.

04 / 06

After the job

  1. Look at what changed before you delete the copy. Keep it for a few days.

  2. If something is wrong, try /rewind first.

  3. If the damage came from a command or a helper agent, restore from your copy.

One optional extra: add a line to your CLAUDE.md file, the file Claude Code reads at the start of every session, such as Before deleting or moving files, list them and ask me first. It is a request to Claude, not a lock, so keep the copy.

05 / 06

Test it safely

  1. Make a dummy folder with three small text files. Copy it using the command for your system.

  2. Run diff -r (Mac or Linux) or open both folders and compare. They should match, including hidden files.

  3. Open Claude Code in the dummy folder, ask it to change one file, then open /rewind, pick the earlier message and choose Restore code. The file should return.

  4. Ask Claude to delete a different file using a command, then try rewind again. Check what comes back.

What was tested: on 8 November 2026 the copy commands were run on a dummy folder with a hidden .env file. cp -R was run in Git Bash on Windows, not on a Mac. robocopy copied everything and exited with code 1, and Copy-Item run twice nested the copy one level too deep, as warned above. git add -A did include the .env file. The rewind steps and limits come from Anthropic's checkpointing page, read the same day. Not tested: a live /rewind session, and restoring a file from a Git commit.

Common mistakes

  1. Opening Claude Code in the copy. Work in the original and leave the copy alone.

  2. Trusting rewind for command changes. Files only a command touched are not tracked.

  3. Skipping the check. Open the copy once and look inside.

  4. Pushing a repository that holds .env files. Keep restore-point repositories local.

Does rewind work for everything Claude does?

No. It covers edits made with Claude's own file editing tools. Commands, most helper agents and outside changes are the gaps.

How long are rewind snapshots kept?

By default about 30 days after a session last saved one, and only for the 100 most recent checkpoints in a session.

Why not just use Git?

Git is a good restore point if you already use it. A plain folder copy works for people who do not. Do either one before a big job.

Do I need to code?

No. You type one copy command, or use right-click, Copy, Paste.

Finish line

What to do next

  1. Pick the folder Claude will work on next.

  2. Make the copy and open it once.

  3. Save this page for the next time a job goes sideways.

Back to all the free guides. Two that pair well with this one: AI guardrails that hold and run Claude Code overnight safely.

You reached the end of the guide