Branch Guard
blocking stable
Prevents direct mutations to protected branches (main, release/*). Intercepts git commit, merge, rebase, cherry-pick, revert, am, pull, and push operations when the current HEAD is a protected branch. Requires explicit approval per Common.md §2.2.
ai hooks run branch-guard
Event
PreToolUse Language python Trigger tool-name — Bash Side effects - blocks tool call with explanation
- emits protected-branch warning
linuxmacoswindows Logic is cross-platform. Wiring: use 'ai hooks run branch-guard' in settings.json — the ai binary discovers Python on each OS. Inspects git command strings — git works cross-platform. Python shebang ignored on Windows; invoked via 'ai hooks run'.
gitgovernancebranch-protectionclaude-code
Attribution: convergent-systems-key.