hub-pull-request(1)

Okay bestie, welcome to the hub-pull-request(1) page from the hub manual. This is where we learn how to create GitHub Pull Requests, and it's literally the most iconic thing you'll do all day. Let's get into it, fr fr. πŸ’–


🌟 NAME 🌟

So like, hub-pull-request is the command to create a GitHub Pull Request. That's it. That's the whole vibe. It's giving "let me make a PR real quick" energy, and we love that for us. ✨


πŸ’… SYNOPSIS πŸ’…

Here's the vibe of how you invoke this thing, bestie. Copy these exactly, okay?

hub pull-request [-focpd] [-b BASE] [-h HEAD] [-r REVIEWERS ] [-a
ASSIGNEES] [-M MILESTONE] [-l LABELS]
hub pull-request -m MESSAGE [--edit]
hub pull-request -F FILE [--edit]
hub pull-request -i ISSUE

So like, you can use it with a bunch of flags, or with -m MESSAGE, or with -F FILE, or with -i ISSUE. Each one does a different thing, and we'll get into that in the options. πŸ’…


✨ OPTIONS ✨

Okay bestie, here's the full tea on every single option. No skips, no cap. 🫢

  • -f, --force β€” Like, skip the check for unpushed commits. We're being bold today, no cap.
  • -m, --message MESSAGE β€” Okay so here's the deal: the text up to the first blank line in MESSAGE is treated as the pull request title, and the rest is used as the pull request description in Markdown format. When multiple --message are passed, their values are concatenated with a blank line in-between. And when neither --message nor --file were supplied, a text editor will open for you to author the title and description in. So convenient, fr fr.
  • --no-edit β€” Use the message from the first commit on the branch as the pull request title and description without opening a text editor. So like, no editor, just vibes. 😌
  • -F, --file FILE β€” Read the pull request title and description from FILE. Pass "-" to read from standard input instead. See --message for the formatting rules. So like, if you have a template file, this is your moment. πŸŽ€
  • -e, --edit β€” Open the pull request title and description in a text editor before submitting. This can be used in combination with --message or --file. So like, you can edit before you commit to it. Boundaries, period. πŸ’…
  • -i, --issue ISSUE β€” Convert ISSUE (referenced by its number) to a pull request.
⚠️ Warning: You can only convert issues authored by you or that which you have admin rights over. And honestly, in most workflows it is not necessary to convert issues to pull requests; you can simply reference the original issue in the body of the new pull request. So much easier, bestie.
  • -o, --browse β€” Open the new pull request in a web browser. So like, it pops off in your browser. Iconic. 🌐
  • -c, --copy β€” Put the URL of the new pull request to clipboard instead of printing it. So like, copy-paste realness. πŸ“‹
  • -p, --push β€” Push the current branch to HEAD before creating the pull request. So like, push it real good. πŸš€
  • -b, --base BASE β€” The base branch in the "[OWNER:]BRANCH" format. Defaults to the default branch of the upstream repository (usually "master"). See the "CONVENTIONS" section of hub(1) for more information on how hub selects the defaults in case of multiple git remotes. So like, if you have multiple remotes, check the conventions. iykyk.
  • -h, --head HEAD β€” The head branch in "[OWNER:]BRANCH" format. Defaults to the currently checked out branch. So like, it knows where you're at. πŸ‘‘
  • -r, --reviewer USERS β€” A comma-separated list (no spaces around the comma) of GitHub handles to request a review from. So like, tag your friends, bestie. πŸ‘―β€β™€οΈ
  • -a, --assign USERS β€” A comma-separated list (no spaces around the comma) of GitHub handles to assign to this pull request. So like, assign the squad. 🫢
  • -M, --milestone NAME β€” The milestone name to add to this pull request. Passing the milestone number is deprecated. So like, use the name, not the number, bestie. Deprecated means don't do it. πŸ’€
  • -l, --labels LABELS β€” A comma-separated list (no spaces around the comma) of labels to add to this pull request. Labels will be created if they do not already exist. So like, label it up. 🏷️
  • -d, --draft β€” Create the pull request as a draft. So like, not ready for review yet. Draft mode activated. πŸ“
  • --no-maintainer-edits β€” When creating a pull request from a fork, this disallows projects maintainers from being able to push to the head branch of this fork. Maintainer edits are allowed by default. So like, if you want to keep your fork on lock, this is the flag. Boundaries, period. πŸ”’

πŸŽ€ EXAMPLES πŸŽ€

Okay bestie, here are some examples to slay with. Copy these exactly, okay? πŸ’–

$ hub pull-request
[ opens a text editor for writing title and message ]
[ creates a pull request for the current branch ]

$ hub pull-request --base OWNER:master --head MYUSER:my-branch
[ creates a pull request with explicit base and head branches ]

$ hub pull-request --browse -m "My title"
[ creates a pull request with the given title and opens it in a browser ]

$ hub pull-request -F - --edit < path/to/message-template.md
[ further edit the title and message received on standard input ]

So like, the first one is the classicβ€”just hub pull-request and it opens a text editor for you to write the title and message, then creates a pull request for the current branch. The second one lets you specify the base and head branches explicitly with --base OWNER:master --head MYUSER:my-branch. The third one is for when you're feeling fancyβ€”--browse -m "My title" creates a PR with the given title and opens it in a browser. And the fourth one is for when you have a message template fileβ€”hub pull-request -F - --edit < path/to/message-template.md reads from stdin and lets you further edit the title and message. Chef's kiss. πŸ‘©β€πŸ³πŸ’‹


🧚 CONFIGURATION 🧚

OMG, there's this one env var you should know about: HUB_RETRY_TIMEOUT. It's the maximum time to keep retrying after HTTP 422 on --push, and the default is 9. So like, if the server's being a little flaky, hub will keep trying for up to 9 units of time. Patience is a virtue, but only for 9. ⏳


🌈 SEE ALSO 🌈

Go check out these other icons: hub(1), hub-merge(1), and hub-checkout(1). They're all part of the squad, and you should totally read them if you want to level up your hub game. iykyk. πŸ’…


This manual page is brought to you by hub version 2.14.2 from 07 Jan 2024. Stay slaying, bestie! πŸ’…βœ¨

πŸ“¦ where this page comes from