Replaces Claude Code's built-in git instructions with enhanced, project-aware versions injected at session start.
Set includeGitInstructions: false in your Claude Code settings to disable
the built-in git instructions. This plugin provides its own replacement.
In .claude/settings.json or .claude/settings.local.json:
{
"includeGitInstructions": false
}Or set the environment variable CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1.
At session start, the plugin runs a detection script that:
- Detects your mainline branch (via
origin HEAD, falls back tomain/master) - Detects conventional commits (commitlint config or commit history analysis)
- Detects fork setup (checks for
upstreamremote)
Then injects tailored git instructions covering:
- Git Safety Protocol -- never force push mainline, never skip hooks, prefer specific file staging, prefer new commits over amending
- Commit workflow -- review changes, stage specific files, HEREDOC format, conventional commits format when detected
- Branch workflow -- create from mainline, conventional prefixes when detected, kebab-case naming
- PR workflow -- use GitHub MCP tools, fork-aware PR creation, structured body format (Summary + Test plan)
Install the plugin and set the prerequisite. The plugin works automatically -- no slash commands or special invocations needed. Claude receives the right git instructions from the start of every session.
The plugin auto-detects repository conventions at session start.
| Setting | Detection Method |
|---|---|
| Mainline branch | git ls-remote --symref origin HEAD, local fallback |
| Conventional commits | commitlint config files, commit history pattern matching |
| Fork setup | Presence of upstream remote |
Validate the plugin:
claude plugin validate ./gitTest the script standalone in any git repository:
bash /path/to/git/scripts/git-instructions.shMIT