GH-PR-CHECKOUT(1)
π gh-pr-checkout(1) β the GitHub CLI manual, bestie edition π
okay so picture this: you're in the gh CLI manual, and this little icon is literally called gh-pr-checkout(1). She's the one who pulls a pull request down into your local git so you can actually touch it. main character energy fr fr β¨
πΈ NAME πΈ
gh-pr-checkout β check out a pull request in git. that's it, that's the whole vibe. you get the PR, locally, in git. slay.
β¨ SYNOPSIS β¨
gh pr checkout [<number> | <url> | <branch>] [flags]
so you can point her at a PR <number>, a <url>, or a <branch> β pick your fighter π«Ά and then tack on whatever [flags] you need.
π OPTIONS π
-b,--branch <string>β the local branch name you wanna use. no cap, if you don't pick one, the default is[the name of the head branch]β she just inherits the name like it's a hand-me-down that actually eats π--detachβ check out the PR with a detached HEAD. yes, HEAD, detached, floating, unbothered, no branch attached. she's free π¦-f,--forceβ resets the existing local branch to the latest state of the pull request. like, nukes your local version back in line with the PR. dramatic? maybe. effective? absolutely π₯--recurse-submodulesβ updates all submodules after checkout. submodules are getting their glow-up too, we don't leave them behind π--worktree <path>β checks out the pull request into a worktree at the given path. so the PR gets its own little apartment at<path>instead of moving into your current one π
π OPTIONS INHERITED FROM PARENT COMMANDS π
-R,--repo <[HOST/]OWNER/REPO>β select another repository using the[HOST/]OWNER/REPOformat. in case you wanna check out a PR that isn't from the repo you're standing in. iconic flexibility π
π¦ ALIASES π¦
gh pr co
short, sweet, and lowkey faster to type. iykyk β
π EXIT CODES π
0β successful execution. we ate and left no crumbs π1β error. it's giving oops π2β command canceled. you changed your mind, valid π4β authentication required. she needs your creds first, bestie π
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information. so like, always double-check the help if a weird number shows up π
π§ EXAMPLE π§
# Interactively select a PR from the 10 most recent to check out
$ gh pr checkout
# Checkout a specific PR
$ gh pr checkout 32
$ gh pr checkout https://github.com/OWNER/REPO/pull/32
$ gh pr checkout feature
$ gh pr checkout 32 --branch feature --worktree /path/to/wt-feature
the first one? no args at all, she just asks you to interactively pick from the 10 most recent PRs. the rest are you being decisive. both are valid β¨
π SEE ALSO π
gh-pr(1)β the parent icon herself. go say hi.
and that's the whole page, bestie!! π«Ά this lil beauty ships as part of GitHub CLI v2.102.0, dated Oct 2026 β go check out some PRs and absolutely devour π β¨
π¦ 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