What problem does it solve?
Accidental execution of destructive git commands like force push, hard reset, or branch deletion in Claude Code can cause irreversible data loss, broken repositories, and lost work, with no easy way to undo the damage.
Core Features & Use Cases
- Pre-execution command blocking: Sets up a PreToolUse hook that intercepts dangerous git commands before Claude Code runs them, stopping accidental execution before any damage occurs.
- Configurable blocked command list: Blocks the most common high-risk git operations by default, including all variants of git push, git reset --hard, git clean, git branch -D, and full-file checkout/restore commands.
- Flexible scope installation: Supports installing the guardrails for a single project or globally across all Claude Code environments, with automatic merging into existing settings files to avoid overwriting other configurations.
- Use Case: A developer using Claude Code to make quick changes can avoid accidentally force pushing unfinished work to the main branch or wiping their local changes with a stray reset --hard command.
Quick Start
Use the git-guardrails-claude-code skill to install configurable hooks that block destructive git commands in your Claude Code environment.