Setup Git Guardrails
Install a PreToolUse hook that blocks destructive git commands before they run.
Blocked commands
git pushgit reset --hardgit clean -f/git clean -fdgit branch -Dgit checkout ./git restore .
Workflow
- Ask whether to install for this project or globally.
- Copy
scripts/block-dangerous-git.shinto the target hooks directory. - Make it executable.
- Merge the hook into the relevant Claude settings file.
- Ask whether the blocked pattern list should be customized.
- Verify with a sample blocked command.