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

  1. User asked to revert a boxShadow migration commit
  2. Claude ran git stash (which does not capture untracked files)
  3. Claude ran git clean -fd to "clean up" the working directory
  4. This permanently deleted all untracked files, including files the user was actively working on in parallel

Why this is a problem

  • git clean -fd is a destructive, irreversible operation
  • Claude's own system instructions explicitly say to confirm before running destructive operations
  • The untracked files were visible in git status and 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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗