Gh Issue Fix Pr
Overview
Use this workflow to implement issue-driven changes with gh, keep work isolated in a new branch, and open a PR that references the issue numbers.
Workflow
- •Confirm issue numbers
- •If issue numbers are missing or ambiguous, ask the user to provide them.
- •If multiple issues are provided, treat them as a single change set unless the user asks to split work.
- •Fetch issue context with gh
- •Use
gh issue view <id> --webonly when needed; prefergh issue view <id>for CLI details. - •Capture required acceptance criteria, labels, and any linked PRs.
- •Synchronize with origin
- •Ensure local
mainis up to date before branching to avoid merge conflicts. - •Suggested sequence:
- •
git fetch origin - •
git checkout main - •
git pull --ff-only origin main
- •
- •Create a branch
- •Base on
mainunless the repo uses a different default. - •Suggested naming:
issue-<id>-<short-slug>orissues-<id1>-<id2>-<slug>.
- •Implement changes
- •Follow repo instructions and existing patterns.
- •Keep scope tight to the issue(s).
- •Add or update tests when reasonable.
- •Validate
- •Run the smallest test or build commands that establish confidence.
- •If tests are not run, state why in the PR description.
- •Commit
- •Use a clear commit message, e.g.
Fix #123: <short summary>orImplement #123/#124: <summary>.
- •Create PR and link issues
- •Use
gh pr create --base main --head <branch>. - •Include
Fixes #<id>orCloses #<id>in the PR body to auto-link. - •For multiple issues, list each on its own line.
- •Share outcome
- •Provide the PR URL, branch name, and a brief summary.
- •Call out any follow-ups or risks.
Suggested gh commands (examples)
bash
gh issue view 123 git checkout -b issue-123-short-slug # implement changes git status git add -A git commit -m "Fix #123: short summary" gh pr create --base main --head issue-123-short-slug \ --title "Fix #123: short summary" \ --body $'Fixes #123\n\nSummary:\n- ...\n\nTesting:\n- ...'
Notes
- •If the repo requires a different base branch, use it consistently for both branch creation and PR base.
- •If CI or policy requires specific PR templates, follow them.