Back to Hooks

Prevent Direct Push

Hooks git 484

Prevent direct pushes to protected branches (main, develop). Blocks git push commands targeting main or develop branches to enforce Git Flow workflow. Requires using feature/release/hotfix branches and pull requests instead of direct commits to protected branches.

Install Command
npx claude-code-templates@latest --hook git/prevent-direct-push
View on GitHub
claude-code — prevent-direct-push

Content

JSON
{
"description": "Prevent direct pushes to protected branches (main, develop). Blocks git push com..."
"hooks": {
"PreToolUse": [1 item]
}
}

Stack Builder

0 components

Your stack is empty

Browse components and click the + button to add them to your stack for easy installation.