From git-workflow
Creates a branch (if needed), pushes changes, and opens a pull request with proper naming conventions
npx claudepluginhub zookanalytics/claude-devcontainer --plugin git-workflow# Create Pull Request **User-provided context:** $ARGUMENTS ## Arguments - `--ready` - Create PR as ready for review (not draft). Triggers CI immediately. By default, PRs are created as **drafts** to conserve GitHub Action minutes during iteration. Use `--ready` when confident the PR is ready for CI and review. ## Pre-flight Check and Current State (PARALLEL) **Run these commands in parallel** (no dependencies between them): **After both complete:** - **If `git status --porcelain` shows changes: STOP.** - Report: "Cannot create PR - uncommitted or untracked changes detected" ...
/create-pull-requestCreates a draft GitHub pull request using gh CLI with conventional emoji-prefixed titles and body from .github/pull_request_template.md.
/create-pull-requestCreates a draft GitHub pull request using gh CLI with conventional emoji-prefixed titles and body from .github/pull_request_template.md.
/create-pull-requestProvides step-by-step GitHub CLI guide for creating pull requests, enforcing title conventions, template usage, best practices, and example commands.
/create-pull-requestProvides step-by-step GitHub CLI guide for creating pull requests, enforcing title conventions, template usage, best practices, and example commands.
/create-pull-requestProvides step-by-step GitHub CLI guide for creating pull requests, enforcing title conventions, template usage, best practices, and example commands.
/create-pull-requestCreates GitHub pull requests using gh CLI with conventional commit titles, structured markdown descriptions, issue links, labels, and reviewers.
User-provided context: $ARGUMENTS
--ready - Create PR as ready for review (not draft).
Triggers CI immediately.By default, PRs are created as drafts to conserve GitHub Action minutes during iteration.
Use --ready when confident the PR is ready for CI and review.
Run these commands in parallel (no dependencies between them):
git status --porcelain # Check for uncommitted changes
git branch --show-current # Determine current branch
After both complete:
git status --porcelain shows changes: STOP.
Always fetch before checking for divergence:
git fetch origin
Run both merge-base commands in parallel:
git merge-base --is-ancestor origin/main HEAD && echo "AHEAD_OR_EQUAL"
git merge-base --is-ancestor HEAD origin/main && echo "BEHIND_OR_EQUAL"
Interpretation:
| Result | Meaning | Action |
|---|---|---|
| Both succeed | HEAD and origin/main are equal | STOP - nothing to PR |
| First only (AHEAD) | origin/main is ancestor of HEAD | Normal flow - create branch |
| Second only (BEHIND) | HEAD is ancestor of origin/main | STOP - fast-forward first |
| Neither (DIVERGED) | Branches have diverged | Create branch, then rebase |
If origin/main has commits not in local main:
This happens when commits were merged to main remotely while you worked locally. Local commits on main are always WIP intended for a PR, never direct pushes.
Resolution:
Create feature branch from current HEAD (preserving your work):
git checkout -b <branch-name>
Rebase onto updated origin/main:
git rebase origin/main
If rebase conflicts occur:
git add <file> and git rebase --continueAfter successful rebase, continue with push step
If rebase fails completely (too many conflicts, cannot resolve):
git rebase --abortgit merge origin/mainGet commits that will be included:
git log origin/main..HEAD --oneline
If no commits ahead of origin/main: STOP.
Use the pull-request-conventions skill for naming format.
Analyze the commits to determine:
feat, fix, docs, chore, refactor, test, build, ci, perf, style)Format: <type>/<description>
Examples based on commits:
feat/user-authenticationfix/login-validationdocs/api-updatesgit checkout -b <branch-name>
Check if branch is already pushed:
git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null
If tracking branch exists: Check if up to date. If no tracking branch: Push with upstream:
git push -u origin <branch-name>
gh pr list --head <branch-name> --json number,url --jq '.[0]'
If PR already exists:
url"Reference the pull-request-conventions skill for title format.
Derive from commits, not branch name. The branch name is a short handle that may have diverged from the actual changes. Analyze the commits to determine the appropriate title.
Process:
git log origin/main..HEAD --onelinefeat, fix, refactor, etc.)Examples:
feat(auth): add user authenticationfix: resolve login validation errordocs(api): update endpoint documentationfeat/123-user-auth with commits that add JWT → feat(auth): add JWT-based authenticationAnalyze commits to create description:
git log origin/main..HEAD --pretty=format:"- %s"
Description format:
## Summary
<1-3 bullet points summarizing the changes>
## Test plan
<How to verify - infer from changes or use "Tested locally">
If --ready flag provided (create as ready for review):
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<bullet points>
## Test plan
<verification steps>
EOF
)"
Otherwise (default - create as draft):
gh pr create --draft --title "<title>" --body "$(cat <<'EOF'
## Summary
<bullet points>
## Test plan
<verification steps>
EOF
)"
After successful creation, report:
For draft PRs:
Created draft PR #<number>: <title>
<url>
CI is skipped for draft PRs. When ready for CI and review:
- Run: /git:orchestrate --ready
- Or manually: gh pr ready <number>
For ready PRs:
Created PR #<number>: <title>
<url>
Common failures:
gh auth statusReport the error clearly and stop.