antrophiclove
← Kütüphaneye dön
Kurulum
curl -sL https://www.antrophiclove.com/api/kaynak/branch-guard/raw

Bu içerik mevcut dosyaya elle harmanlanmalı: .claude/settings.json

branch-guard

Prevents accidental git push commands to main or master branches. Allows pushes to feature/staging branches.

Event Configuration

  • Event Type: PreToolUse
  • Tool Matcher: Bash
  • Category: security

What It Blocks

  • git push origin main
  • git push --force origin master
  • Any variant targeting protected branches

What It Allows

  • git push origin feature-branch
  • git push origin develop
  • All other git commands
  • All non-git commands

Environment Variables

VariableDefaultDescription
CC_PROTECT_BRANCHESmain:masterColon-separated list of protected branches

Example: Protect additional branches

export CC_PROTECT_BRANCHES="main:master:production:release"

Requirements

  • jq for JSON parsing

Source

From claude-code-hooks — battle-tested hooks from 140+ hours of autonomous Claude Code operation.