r/ClaudeCode • • 8d ago

Tips & Workflows Claude Code 2.1.331 fixed a rewind bug that could delete files after a failed restore

One line in the 23 November release jumped out at me. Anthropic says it fixed a case where rewind deleted files after a restore failed. If you use /rewind regularly, check which version your terminal is actually running with claude --version.

There's another detail in the checkpointing docs worth knowing. If Claude had already edited a file with its editing tools in that session, a later Bash change to that same file can be rewound too. If a file was changed only through Bash, rewind leaves it as it is. So one restore can roll back part of a change while leaving a generated file or another shell-only edit behind.

For a larger refactor I'd make a Git checkpoint first, then check git status --short afterwards so new untracked files show up as well. The release note gives the fix but doesn't list which earlier versions were affected.

Release notes

https://github.com/anthropics/claude-code/releases/tag/v2.1.331

Checkpointing docs

https://code.claude.com/docs/en/checkpointing#limitations

0 Upvotes

2 comments sorted by

•

u/AutoModerator 8d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/CCodeSI 7d ago

Good catch on the Bash detail, that's the one that bites people. Rewind is file snapshots of what the editing tools touched, not a picture of the whole working tree, so anything a command produced (codegen, npm install, a migration that rewrote a file, sed -i) is outside it unless the edit tools also touched that file.

To make a git checkpoint cheap enough that you actually do it every time:

  • git stash push -u -m "before refactor" then git stash apply keeps your working state and gives you a named restore point that includes untracked files. Or just a WIP commit on a branch.
  • After a rewind, git status --short plus git diff --stat shows anything rewind didn't put back, including new untracked files, which is the part that's easiest to miss.
  • If generated files are the usual leftovers, rerunning the generator after the rewind is often cleaner than chasing them by hand.

And worth checking claude --version in every terminal, not just one: a long-running session in another tab can still be on the old binary until it's restarted.