[Bug] Claude Code ignores user instruction to preserve local files during git-filter-repo operation
Bug Description
Claude Code deleted local files despite explicit instruction to preserve them.
User Request
Asked to remove large embedding files (~2.8GB) from Git tracking/history, explicitly stating:
"_remove from tracking/Git, but I don't want the local files deleted in the process_."
What Claude Did Wrong
Claude ran git-filter-repo --path scriptures/embeddings/ --invert-paths --force without first backing up the local files to a safe location. This command rewrites Git history AND removes the files from the working directory.
Correct Approach
Claude should have:
- Copied the embeddings folder to a temporary location (e.g.,
cp -r scriptures/embeddings/ /tmp/embeddings_backup/) - Run
git-filter-repo - Restored the files from the backup
Consequence
We lost ~2.8GB of OpenAI-generated embeddings that cost real money to produce. No local backup existed, and Time Machine was not available.
Root Cause
Claude proceeded with a destructive operation without implementing the safeguard explicitly requested. Claude acknowledged the requirement in the response ("I'll remove them from Git history while preserving your local files") but failed to execute a backup step before running the destructive command.
Environment Info
| Field | Value |
| ----------- | -------------------------------------- |
| Platform | darwin |
| Terminal | Apple_Terminal |
| Version | 2.1.4 |
| Feedback ID | 8f735022-38dc-421c-a543-beb1026c85a0 |
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗