Your task is to create or update the GitHub Pull Request for the current branch.
Steps
Run these commands in parallel to gather context:
git log --oneline $(git merge-base HEAD master)..HEAD— commits on this branchgit diff $(git merge-base HEAD master)..HEAD --stat— changed files summarygh pr view --json number,title,body,state 2>/dev/null— existing PR, if any
Analyze all commits and changed files to understand the intent of the branch.
Build the PR title:
- Follow conventional commits:
type(scope): short description - Use the most significant type across all commits (
feat>fix>refactor>chore) - If there is only one commit and its message is already a good title, use it directly
- Keep it under 72 characters
- Do not add a period at the end
- Follow conventional commits:
Build the PR body using this template:
## Summary
- <bullet 1>
- <bullet 2>
## Changes
- <file or area>: <what changed and why>
## Test plan
- [ ] <step to verify>
- Summary: 2–4 bullets on what and why, not how
- Changes: one line per meaningful file group or area changed
- Test plan: concrete steps a reviewer can follow to verify the PR
- If no PR exists for this branch, create one targeting
master:
gh pr create --title "..." --body "$(cat <<'EOF'
...
EOF
)"
- If a PR already exists, update its title and body:
gh pr edit --title "..." --body "$(cat <<'EOF'
...
EOF
)"
- Output the PR URL at the end.
Rules
- Never push commits — only create or edit the PR metadata
- If the branch has no commits ahead of master, tell the user and stop
- Use the
ghCLI for all GitHub operations - Always use a HEREDOC (
<<'EOF') to pass the body so newlines are preserved
Source: lukascivil/TreeWalker — distributed by TomeVault.