| name | managing-git-workflow |
| description | Automates git commits, push, and PR creation with context-aware messages that match the project's language and conventions, plus automatic ticket extraction from branch names. Use when performing any git operation, creating commits or PRs, pushing changes, or when user says "commit", "push", "pull request", "PR", "save my changes", "send my code", "open a PR", "git", or "GitHub". |
| allowed-tools | Bash(git:*) Bash(gh:*) |
Managing Git Workflow
Overview
Handles the full commit-push-PR pipeline so you can focus on code, not git mechanics. Commit messages are generated by analyzing the diff and matching the project's existing style and language. Ticket numbers are extracted automatically from branch names.
When to Use
- Creating commits with auto-generated messages in project's language
- Pushing changes (with automatic commit if needed)
- Creating PRs (with automatic push and commit if needed)
- When user mentions: git, commit, push, pull request, PR, GitHub
Workflow Selection
| Task | Reference Document | Handles internally |
|---|
| Commit only | managing-git-workflow/reference/commit.md | — |
| Push to remote | managing-git-workflow/reference/push.md | Commit (if uncommitted changes) |
| Create PR | managing-git-workflow/reference/pr.md | Commit + Push (if needed) |
Each workflow is self-contained — no delegation between reference files. This eliminates duplicate state checks.
Common Principles
Commit Messages:
- Use language specified in project context, prompts, or documentation (default to English if unspecified)
- Follow existing project patterns (analyze with
git log --oneline -10)
- Include ticket numbers (e.g.,
PROJ-123, TEAM-456) if found in branch name or changes
Branch Naming:
- Extract ticket numbers from branch names for PR titles
- Use descriptive, concrete names
All commands start with git or gh — the allowed-tools field uses prefix patterns (Bash(git:*), Bash(gh:*)), so commands that don't start with these prefixes will be rejected by the permission system.
Bash Call Optimization
Fewer Bash calls means faster execution and fewer permission prompts for the user:
- Combine independent reads with
; separator in a single Bash call (e.g., git status --porcelain; git log --oneline -10; git branch --show-current)
- Chain sequential writes with
&& in a single Bash call (e.g., git add -A && git commit -m "..." && git push)
- Self-contained workflows: Each workflow handles its own state checks inline — no delegation between reference files. This avoids duplicate context-gathering steps.
- Pre-staging analysis: Use
git diff HEAD --stat before staging to analyze changes without a separate git add call
- Inline verification: Append verification to write calls (e.g.,
git commit -m "..." && git log --oneline -1)
- Separate
git and gh commands: Keep git-prefixed and gh-prefixed commands in separate Bash calls because each matches a different permission pattern
Quick Reference
git status --porcelain
git rev-list --count @{u}..HEAD
git branch --show-current
gh pr list --head "$(git branch --show-current)" --json number --jq 'length'
Implementation
For commit workflow: See managing-git-workflow/reference/commit.md
For push workflow: See managing-git-workflow/reference/push.md
For PR workflow: See managing-git-workflow/reference/pr.md
Each reference document provides step-by-step instructions for that specific operation.