branch-commit-guard

Block direct commits on protected branches during staging, committing, or pushing.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/tubtrb/autoreport --skill branch-commit-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: branch-commit-guard
Source: https://github.com/tubtrb/autoreport/tree/main/codex/skills/branch-commit-guard
Command: npx skills add https://github.com/tubtrb/autoreport --skill branch-commit-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This skill prevents direct commits on protected integration branches, reducing accidental changes and enforcing repository policy.

Core Features & Use Cases

  • Proactively blocks direct commits on protected branches during routine development.
  • Allows explicit override for intentional integration work using the --allow-protected flag.
  • Provides a suggested child branch name to isolate work when blocked.

Quick Start

Run the guard script before staging or committing on protected branches to enforce safety and avoid accidental commits.

Frequently Asked Questions about branch-commit-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent direct commits to protected git branches?

To prevent direct commits to protected git branches, use a guard script that intercepts staging, committing, or pushing actions and exits with a status code 2 to block routine modifications on integration branches.

How do I allow an intentional commit to a protected branch when blocked?

You can allow an intentional commit to a protected branch by passing the explicit --allow-protected override flag to the guard script, bypassing the block for authorized integration work.

What happens when a git branch guard blocks my commit?

When a git branch guard blocks your commit, it exits with status 2 and suggests creating a child branch to isolate your development work away from the protected integration branch.

When should I use a branch protection script in my devops workflow?

You should use a branch protection script in your devops workflow when you need to enforce repository policy proactively and reduce accidental changes to critical integration branches during routine development.

Does the branch-commit guard require external dependencies to run?

No, the branch-commit guard requires no external dependencies to run, as it operates as a standalone script to enforce branch safety and check protected branch names during your git workflow.