pr
Create a GitHub PR from current branch with unpushed commits — discovers templates, analyzes changes, pushes
- Kind
- Prompt
- Works with
- Claude Code, Codex
- Source
- affaan-m/ECC @ d3b8a3e90890
- Path
- commands/pr.md
- License
- MIT
- Jobs
- Git workflow, Review
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
# Create Pull Request **Input**: `$ARGUMENTS` — optional, may contain a base branch name and/or flags (e.g., `--draft`). **Parse `$ARGUMENTS`**: - Extract any recognized flags (`--draft`) - Treat remaining non-flag text as the base branch name - Default base branch to `main` if none specified --- ## Phase 1 — VALIDATE Check preconditions: ```bash git branch --show-current git status --short git log origin/<base>..HEAD --oneline ``` | Check | Condition | Action if Failed | |---|---|---| | Not on base branch | Current branch ≠ base | Stop: "Switch to a feature branch first." | | Clean working directory | No uncommitted changes | Warn: "You have uncommitted changes. Commit or stash first." | | Has commits ahead | `git log origin/<base>..HEAD` not empty | Stop: "No commits ahead of `<base>`. Nothing to PR." | | No existing PR | `gh pr list --head <branch> --json number` is empty | Stop: "PR already exists: #<number>. Use `gh pr view <number> --web` to open it." | If all checks pass, proceed. --- ## Phase 2 — DISCOVER ### PR Template Search for PR template in order: …