Once upon the time Claude Code wiped whole git repo of my side project, cleaned up orphaned references, and force pushed to remote - no second thoughts.
Then I restored it from backup and wrote a Claude Code skill - a safety checklist that triggers before any dangerous git operation (git reset --hard, git push --force, git rebase, git clean -fd, git branch -D):
- Back up the repo:
cp -r .git .git-backup-$(date +%Y%m%d-%H%M%S) - Work in a separate worktree when possible
- Prefer
--force-with-leaseover--force - Know your escape hatch:
git reflog
May be Anthropic should add a dedicated git tool to Claude Code with proper guardrails - confirmation prompts for destructive commands, automatic backups before history-rewriting operations.
It seems too dangerous to treat git as one more bash command.
