Claude ran git clean -fd without permission, destroyed untracked files
Open 💬 3 comments Opened Apr 9, 2026 by mboa-inc
What happened
During a conversation where the user asked to revert a commit, Claude ran git clean -fd without asking for permission, permanently deleting all untracked files from the working directory.
Steps that led to the issue
- User asked to revert a boxShadow migration commit
- Claude ran
git stash(which does not capture untracked files) - Claude ran
git clean -fdto "clean up" the working directory - This permanently deleted all untracked files, including files the user was actively working on in parallel
Why this is a problem
git clean -fdis a destructive, irreversible operation- Claude's own system instructions explicitly say to confirm before running destructive operations
- The untracked files were visible in
git statusand clearly part of the user's active work - There is no way to recover files deleted by
git clean - The user lost work that cannot be identified or fully recreated
Expected behavior
Claude should NEVER run git clean -fd without explicit user confirmation. It should be treated the same as git reset --hard or rm -rf — a dangerous command that requires approval.
Environment
- Claude Code CLI
- macOS
- Model: claude-opus-4-6
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗