This hook runs on the PreToolUse event, inspecting git commands before Bash executes them. It catches attempts to push to sensitive branches.
When the target is main or develop, the push is blocked, forcing the workflow through feature, release or hotfix branches and pull requests.
When to use
- When the project adopts Git Flow and wants to protect its main branches.
- When you want to avoid accidental direct commits to production.
How to use
After installing, it intercepts every push automatically. Work on separate branches and open PRs to integrate your changes.