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 ![alt](./login.png), 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 of create
  • -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/REPO format

πŸŽ€ 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