| name | git-pr-workflow |
| description | Git workflows for feature branches, merges, and PR creation with GitHub CLI. Use when asked to manage branches, sync with base, resolve conflicts, or create PRs. |
Git PR Workflow
Overview
Standardize branch management and PR creation with GitHub CLI. Favor clear, minimal steps and ask for missing details (base branch, target repo, reviewers, labels) only when needed.
Branch workflow
- Sync main (or chosen base):
git checkout main
git pull origin main
- Create feature branch:
git checkout -b feat/short-description
- Push with tracking on first push:
git push -u origin feat/short-description
- Subsequent pushes:
git push
Syncing with base
Rebase on the latest base branch to avoid conflicts:
git fetch origin
git rebase origin/main
If rebase is not desired, merge instead:
git fetch origin
git merge origin/main
PR preparation
- Ensure branch is pushed:
git push -u origin feat/short-description
- Confirm gh is authenticated:
gh auth status
PR creation (GitHub CLI)
Basic PR:
gh pr create --title "type(scope): short description" --body "Detailed description"
Draft PR:
gh pr create --draft --title "wip: short description" --body "Work in progress"
With reviewers/labels/base:
gh pr create --base develop --title "fix(scope): short description" --body "Details" --reviewer @username --label bug,urgent
PR description template (raw markdown)
When asked to generate PR content, output raw markdown exactly using this template:
## Summary
[1-2 sentences: what changed and why]
## High-Level Changes
- [Change 1]: [user-facing or architectural impact]
- [Change 2]: [impact]
## Detailed Implementation
- [Component Architecture]: [new/changed components]
- [State Management & Logic]: [state/data/validation changes]
- [Dependencies]: [new/updated packages]
## Test Plan
- [ ] Manual test step 1
- [ ] Manual test step 2
- [ ] Automated tests pass
Multi-worktree notes
If working across multiple worktrees (e.g. ansel-agent-a, ansel-agent-b):
- Confirm the active worktree before running commands:
pwd
git status -sb
git rev-parse --show-toplevel
- List worktrees when unsure:
- Use
git -C /path/to/worktree ... if needed.
Troubleshooting
- Branch not on remote:
git push -u origin <branch>
- No commits to PR:
git log main..HEAD
git status -sb
- GH auth issues:
gh auth status
gh auth login