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/REPO format. 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