Skip to content
Latchkey

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

Terminal
# 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 --draft

Common 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

OptionPurpose
-t, --titlePR title
-b, --bodyPR body (or --body-file)
-B, --baseBase branch
-H, --headHead branch (owner:branch for forks)
-f, --fillUse commit info for title/body
-d, --draftCreate as a draft

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →