GH-PR-UPDATE-BRANCH(1)

✨ GH-PR-UPDATE-BRANCH(1) ✨

ok so we're diving into the gh-pr-update-branch page from the GitHub CLI manual, bestie β€” buckle up, it's gonna be quick and cute πŸ’–


🌸 NAME 🌸

gh-pr-update-branch β€” literally just: update a pull request branch. that's the whole vibe 🫢


πŸŽ€ SYNOPSIS πŸŽ€

gh pr update-branch [<number> | <url> | <branch>] [flags]

like, you can pass it a number, a url, or a branch name β€” or honestly nothing at all, she's flexible πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So what does she actually do? She updates a pull request branch with the latest changes from the base branch. Fresh-ish. Caught up. Slay ✨

If you don't give her an argument, she just goes ahead and picks the pull request that belongs to your current branch β€” no cap, she just knows 🧚

Now here's the important part, bestie, pay attention πŸ‘€ The default behavior is to update with a merge commit β€” meaning it merges the base branch into the PR's branch. That's the default. That's what happens if you say nothing.

But if you want to reconcile the changes by rebasing on top of the base branch instead? Then you gotta pass the --rebase option. You have to ask for it. It is not the default. periodt πŸ’€


πŸ’œ OPTIONS πŸ’œ

  • --rebase β€” updates the PR branch by rebasing it on top of the latest base branch. this is the one you want when merge commits just aren't your aesthetic πŸ¦‹

🌈 OPTIONS INHERITED FROM PARENT COMMANDS 🌈

  • -R, --repo <[HOST/]OWNER/REPO> β€” picks a whole different repository, using the [HOST/]OWNER/REPO format. yes the [HOST/] part is optional, iykyk πŸ‘‘

πŸ”₯ EXIT CODES πŸ”₯

  • 0 β€” successful execution πŸ’– everything went great, we love to see it
  • 1 β€” error 😭 something broke
  • 2 β€” command canceled πŸ™ˆ you (or something) hit the brakes
  • 4 β€” authentication required πŸ” like, who even are you? log in first
NOTE: specific commands may have additional exit codes. refer to the command's help for more information. don't come for me, I'm just the messenger πŸ’…

⭐ EXAMPLE ⭐

here's the receipts, copy-paste away bestie:

$ gh pr update-branch 23
$ gh pr update-branch 23 --rebase
$ gh pr update-branch 23 --repo owner/repo

PR number 23 getting the glow-up three different ways. iconic πŸ‘‘


πŸ“ SEE ALSO πŸ“

  • gh-pr(1) β€” the main character herself 🌟

ok that's the whole page, you ate that πŸ’…

sign-off time: this lil masterpiece comes from GitHub CLI v2.102.0, dated Oct 2026 β€” that's the source/version and date, and the manual name for the record is GH-PR-UPDATE-BRANCH(1). mwah πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from