///
Prevent accidental git push to main/master branches without explicit approval
Install
npx agentshq add davepoon/claude-code-subagents-collection --agent branch-guardPrevent accidental git push to main/master branches without explicit approval
Prevents accidental git push commands to main or master branches. Allows pushes to feature/staging branches.
PreToolUseBashgit push origin maingit push --force origin mastergit push origin feature-branchgit push origin develop| Variable | Default | Description |
|----------|---------|-------------|
| CC_PROTECT_BRANCHES | main:master | Colon-separated list of protected branches |
export CC_PROTECT_BRANCHES="main:master:production:release"
jq for JSON parsingFrom claude-code-hooks — battle-tested hooks from 140+ hours of autonomous Claude Code operation.