A local repo wiped when Claude Code ran an unset-variable command
Claude Code in auto mode ran a git worktree command with an empty variable, emptied the project folder including .git, and lost uncommitted work.
Credits
- Reddit poster Charming-Network-456 Source ↗
Earliest dated source:
Auto mode plus a command that hides its own errors can destroy a whole working folder, so commit and keep backups before letting an agent run unattended.
The full story
A user left Claude Code (Opus 5) running in auto mode and came back to find the repository directory completely empty, .git included. Claude's own account says it ran a command to build a baseline worktree where the temp variable was never set, expanded to an empty path, and its errors were sent to /dev/null so it never saw what happened.
The loss covered uncommitted edits and the local clone, plus gitignored local state such as databases, model weights and node_modules. The poster was glad only the local repo was hit.
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 CLI Deleted My Local RepoReddit poster: Charming-Network-456Posted
The maker's post on r/ClaudeCode.
If it disappears: archived copy of Reddit: Claude CLI Deleted My Local Repo (opens in a new tab)