Block risky git commands in Claude Code with one PreToolUse hook
This story is from 2026-10-23. It is preserved in the archive; the latest stories are on the live feed.
An agent with shell access will eventually try git push --force or git reset --hard when it gets confused. You don't need to watch every command. A small PreToolUse hook can stop the dangerous ones before they run. The hook Save this as .claude/hooks/block-risky-git.sh and make it executable ( chmo…
Read the full story at DEV Community — AI ↗
Timeline · 1 report
- 2026-10-23 01:13 · DEV Community — AI
Block risky git commands in Claude Code with one PreToolUse hook