PR Create
Create GitHub pull requests via gh pr create .
Format
Title: Commit subject or change summary
Body:
Summary
- Change description (bullets OK)
Test plan
- Verification steps
Workflow
-
Verify not on main/master
-
Check for existing PR on branch
-
Detect base branch
-
Generate title from commits
-
Build body with summary + test plan
-
Create PR
Commands
Check current branch
git branch --show-current
Check for existing PR
gh pr list --head $(git branch --show-current)
Create PR
gh pr create --title "$TITLE" --body "$(cat <<'EOF'
Summary
- Change 1
- Change 2
Test plan
- Test item EOF )"
Title Generation
Use first commit subject from branch, or summarize if multiple commits:
Single commit - use subject
git log origin/main..HEAD --format='%s' | head -1
Multiple commits - summarize changes
git log origin/main..HEAD --oneline
Body Style
Bullets allowed in PR body (unlike commit messages):
-
Summary section lists changes
-
Test plan uses checkboxes
Keep concise. One line per logical change.
Draft PRs
Use --draft when:
-
Work in progress
-
User requests draft
-
Waiting for CI setup
gh pr create --draft --title "$TITLE" --body "$BODY"
Base Branch
Detect automatically:
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'
Override with --base :
gh pr create --base develop --title "$TITLE" --body "$BODY"
Safety
-
Verify branch is not main/master before creating
-
Check for existing PR to avoid duplicates
-
Never create PR from main to main