gh pr create: Usage, Options & Common CI Errors
Open a pull request from the command line - including from CI.
gh pr create opens a pull request for the current branch. Interactively it prompts for the details; in CI you pass them as flags so it never blocks.
What it does
gh pr create pushes (if needed) and opens a PR from the current branch into a base branch, setting title, body, reviewers, labels, and assignees. With --fill it derives title and body from commits; --draft opens it as a draft.
Common usage
# Interactive
gh pr create
# Non-interactive (CI): explicit title, body, base
gh pr create --title "Add cache layer" --body "Speeds up CI" --base main
# Derive title/body from commits; add labels and reviewers
gh pr create --fill --label ci --reviewer octocat --draftCommon error in CI: no commits / prompts for title
gh pr create fails with "pull request create failed: ... No commits between main and feature" when the branch has nothing new, or it hangs prompting for a title in a non-TTY. Fix: ensure the branch is pushed with real commits ahead of base, and always supply --title and --body (or --fill) in CI so no prompt appears. Set GH_TOKEN with repo scope and pull-requests: write workflow permission, and use --head owner:branch for cross-fork PRs.
Key options
| Option | Purpose |
|---|---|
| -t, --title | PR title |
| -b, --body | PR body (or --body-file) |
| -B, --base | Base branch |
| -H, --head | Head branch (owner:branch for forks) |
| -f, --fill | Use commit info for title/body |
| -d, --draft | Create as a draft |