GH-PR-CREATE(1)
π GH-PR-CREATE β the GitHub CLI manual, but make it make sense
okay bestie, welcome to gh-pr-create, one of the pages in the GitHub CLI manual. this is the one that ships your code off to GitHub in a lil pull request-shaped box π
β¨ NAME β¨
gh-pr-create β create a pull request. that's it. that's the whole job. π
π¦ SYNOPSIS π¦
gh pr create [flags]
πΈ DESCRIPTION πΈ
Create a pull request on GitHub. main character behavior, honestly.
Upon success, the URL of the created pull request will be printed. so you get the receipts π₯
When the current branch isn't fully pushed to a git remote, a prompt will ask where to push the branch and offer an option to fork the base repository. heads up tho: any fork created this way will only have the default branch of the upstream repository. no extra branches, just the default one. Use --head to explicitly skip any forking or pushing behavior. periodt.
--head supports <user>:<branch> syntax to select a head repo owned by <user>. Using an organization as the <user> is currently not supported. For more information, see β¨https://github.com/cli/cli/issues/10093β© β iykyk π
A prompt will also ask for the title and the body of the pull request. Use --title and --body to skip this, or use --fill to autofill these values from git commits. It's important to notice that if the --title and/or --body are also provided alongside --fill, the values specified by --title and/or --body will take precedence and overwrite any autofilled content. so like, your explicit flags win. always. no cap.
The base branch for the created PR can be specified using the --base flag. If not provided, the value of gh-merge-base git branch config will be used. If not configured, the repository's default branch will be used. Run git config branch.{current}.gh-merge-base {base} to configure the current branch to use the specified merge base. config girlies rise π«Ά
Link an issue to the pull request by referencing the issue in the body of the pull request. If the body text mentions Fixes #123 or Closes #123, the referenced issue will automatically get closed when the pull request gets merged. automatic cleanup, we love to see it β¨
Use --attach to upload an image or video. The attachment is appended to the body. If the body references an attached file, such as , that reference is rewritten to point at the uploaded asset instead. You can attach up to 50 files per command. fifty!! go off.
Alt text for an image follows the path after #, as in --attach './login.png#The login error state'. Without it the filename is used. A reference already in the body keeps the alt text written there. Video renders as a player and has no alt text, so it cannot be given any. video said "no thoughts, head empty" π
If some attachments upload and others fail, the pull request is still created with the ones that succeeded. The command then exits with a non-zero status, but the new pull request's URL is still printed to stdout. so like, partial slay. you still get your link π
By default, users with write access to the base repository can push new commits to the head branch of the pull request. Disable this with --no-maintainer-edit. your PR, your rules.
Adding a pull request to projects requires authorization with the project scope. To authorize, run gh auth refresh -s project.
π OPTIONS π
-a,--assignee <login>β assign people by their login. Use"@me"to self-assign. yes, you can assign yourself, we don't judge π--attach <file>β attach an image or video file, in'#'format-B,--base <branch>β the branch into which you want your code merged-b,--body <string>β body for the pull request-F,--body-file <file>β read body text from file (use"-"to read from standard input)-d,--draftβ mark pull request as a draft--dry-runβ print details instead of creating the PR. May still push git changes. so like, it's a dry run for the PR, not for your git pushes, be aware π«Ά-e,--editorβ skip prompts and open the text editor to write the title and body in. The first line is the title and the remaining text is the body. a little writing session, very demure β¨-f,--fillβ use commit info for title and body--fill-firstβ use first commit info for title and body--fill-verboseβ use commits msg+body for description-H,--head <branch>β the branch that contains commits for your pull request (default[current branch])-l,--label <name>β add labels by name-m,--milestone <name>β add the pull request to a milestone by name--no-maintainer-editβ disable maintainer's ability to modify pull request-p,--project <title>β add the pull request to projects by title--recover <string>β recover input from a failed run ofcreate-r,--reviewer <handle>β request reviews from people or teams by their handle-T,--template <file>β template file to use as starting body text-t,--title <string>β title for the pull request-w,--webβ open the web browser to create a pull request
π OPTIONS INHERITED FROM PARENT COMMANDS π
-R,--repo <[HOST/]OWNER/REPO>β select another repository using the[HOST/]OWNER/REPOformat
π ALIASES π
gh pr new β same energy, shorter typing. iconique.
β EXIT CODES β
0β successful execution π1β error π2β command canceled π4β authentication required π
NOTE: specific commands may have additional exit codes. Refer to the command's help for more information.
π EXAMPLE π
$ gh pr create --title "The bug is fixed" --body "Everything works again"
$ gh pr create --reviewer monalisa,hubot --reviewer myorg/team-name
$ gh pr create --project "Roadmap"
$ gh pr create --base develop --head monalisa:feature
$ gh pr create --template "pull_request_template.md"
$ gh pr create --attach './login.png#The login error state'
$ gh pr create --attach ./before.png --attach ./after.png
(and yes, that double space in the --reviewer monalisa,hubot --reviewer myorg/team-name line is exactly how it's written, we are not fixing it π)
π§ SEE ALSO π§
gh-pr(1) β the parent page, go say hi
sign-off π«Ά this lil masterpiece comes to you from GitHub CLI v2.102.0, dated Oct 2026. go create a pull request bestie, you're gonna eat π β¨
π¦ where this page comes from
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms