GitHub PR Create (gh)
Goal
After $git-incremental-commits finishes (working tree clean), push the branch and open a PR with a consistent body format.
Preconditions
- •Repo is on a non-
main/masterbranch. - •
git status -sbis clean. - •
ghis installed and authenticated (gh auth status).
Workflow
- •
Verify working tree is clean.
- •
git status -sb - •Stop if there are uncommitted changes.
- •
- •
Confirm you are on a branch suitable for a PR.
- •
git branch --show-current - •If on
main/masteror detached HEAD: stop and create/switch to a branch.
- •
- •
Ensure the branch is pushed.
- •If no upstream is set:
git push -u origin HEAD - •Otherwise:
git push
- •If no upstream is set:
- •
Determine PR base branch.
- •Prefer the repo default branch:
gh repo view --json defaultBranchRef -q .defaultBranchRef.name
- •Prefer the repo default branch:
- •
Write a PR body in this format (human summary, not diffstats).
- •
Include these headings exactly:
- •
## Summary - •
## Major changes
- •
- •
Conditionally include these headings:
- •
## Screenshots: include only if relevant (UI changes or image diffs). - •
## Tests: include only if the repo has a configured test command/CI expectation. - •
## Additional info: include only if there is something non-obvious to call out (follow-ups, rollout notes, risks).
- •
- •Open the PR with
gh pr create.
- •
Title:
- •Default to a summarized Conventional Commit style title derived from the branch commits (e.g.
Feat: ...,Fix: ...,Docs: ...). - •Override with
PR_TITLE="..."if needed.
- •Default to a summarized Conventional Commit style title derived from the branch commits (e.g.
- •
Body:
- •Use
--bodyor--body-file:- •
gh pr create --title "..." --body-file /tmp/pr-body.md
- •
- •Use
Notes
- •Keep the PR body concise but specific.
- •If there are multiple major changes, list them as bullets under
## Major changes. - •If tests are not configured, omit the entire
## Testssection (do not include an empty heading). - •Avoid including raw
git diff --statoutput in## Summary(GitHub already provides file-level diff context).