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/REPOformat. yes the[HOST/]part is optional, iykyk π
π₯ EXIT CODES π₯
0β successful execution π everything went great, we love to see it1β error π something broke2β command canceled π you (or something) hit the brakes4β 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
- 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