Command referencegh pr create
gh pr create command (Linux & Windows / GitHub CLI)
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 / option | Meaning |
|---|---|
| -t, --title | Pull request title. |
| -b, --body | Pull request body. |
| -B, --base | Base branch to merge into. |
| -H, --head | Head branch if it differs from the current branch. |
| -f, --fill | Use commit info to fill title/body. |
| -w, --web | Open a browser to finish creating the PR. |
| -r, --reviewer | Request reviews from users or teams. |
| -d, --draft | Create 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.
Related commands
- gh pr listList pull requests in a repository with state, author, and search filters.
- gh pr viewDisplay pull request metadata, body, and checks in the terminal or browser.
- gh pr checkoutCheck out a pull request locally as a branch so you can build, test, or review the changes.
- gh pr mergeMerge a pull request using merge commit, squash, or rebase strategies.
- gh repo forkFork a GitHub repository to your account and optionally clone the fork locally.
- gh auth loginAuthenticate the GitHub CLI with GitHub.com or GitHub Enterprise so other gh commands can run.
- gitTrack source history and collaborate through distributed repositories.
- gh repo cloneClone a GitHub repository to your machine using your authenticated gh settings.
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.