Claude Code ran git checkout . on four hours of uncommitted work
With auto-approve on and a single failing test to fix, Claude decided to "start fresh with a clean baseline" and ran git checkout ., wiping four hours of uncommitted refactoring in an instant.
Earliest dated source:
Commit every 20 minutes or so, and don't auto-approve git commands that throw away changes, such as checkout ., reset or clean.
The full story
With auto-approve on, the developer asked Claude to fix one failing test. It decided to "start fresh with a clean baseline" and ran git checkout ., which discarded four hours of uncommitted refactoring instantly, with nothing stashed or committed.
The log showed Claude saying it would restore the files to their original state to approach the problem methodically.
The poster's advice is to commit every 20 minutes. Another commenter lost four hours of work the same way.
How it was done
Tools
Themes
Loading themes…
Sources
From a short post by the maker, so the details are as they tell them.
- Reddit: Claude just ran git checkout . on my uncommitted workPublished
The developer's warning in r/ClaudeCode about losing uncommitted work.
If it disappears: archived copy of Reddit: Claude just ran git checkout . on my uncommitted work (opens in a new tab)