Skip to main content

Command referencegh pr create

gh pr create command (Linux & Windows / GitHub CLI)

Linux & WindowsGitHub CLIgitbeginner

What it does

Create a pull request from the current branch with title, body, reviewers, and base branch options. When people search for gh pr create, they usually want practical GitHub CLI flags, safe examples, and how this subcommand fits everyday PR and repo workflows on Linux, Windows, and macOS. Syntax, options, and copyable examples are below.

Create a pull request from the current branch with title, body, reviewers, and base branch options.

Syntax

gh pr create [flags]

Common options

Flag / optionMeaning
-t, --titlePull request title.
-b, --bodyPull request body.
-B, --baseBase branch to merge into.
-H, --headHead branch if it differs from the current branch.
-f, --fillUse commit info to fill title/body.
-w, --webOpen a browser to finish creating the PR.
-r, --reviewerRequest reviews from users or teams.
-d, --draftCreate as a draft pull request.

Practical examples

Fill from commits

gh pr create --fill

Opens a PR using commit messages for title and body.

Explicit PR

gh pr create --title "Add login rate limit" --body "## Summary\n- …" --base main

Creates a PR against main with a custom title and body.

Draft with reviewers

gh pr create --draft --reviewer teammate

Opens a draft and requests a review.

Browser editor

gh pr create -w

Pushes guidance into the GitHub web compare UI.

Common mistakes

  • Creating a PR before pushing the head branch.
  • Targeting the wrong `--base` on repos with `master` vs `main`.
  • Using `--fill` when commit messages are noisy temporary WIP notes.

FAQ

What does gh pr create do in GitHub CLI?

Create a pull request from the current branch with title, body, reviewers, and base branch options.

Does gh pr create work on Windows and Linux?

Yes. The GitHub CLI (`gh`) runs on Linux, Windows, and macOS with the same subcommand syntax after you authenticate with `gh auth login`.

What is a practical gh pr create example?

Try `gh pr create --fill` — Opens a PR using commit messages for title and body.

Do I need a token in the command line for gh pr create?

Prefer `gh auth login` so credentials stay in the system keyring or secure storage. Avoid pasting personal access tokens into shell history.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.