GIT-PR(1)

okay so bestie, welcome to git-pr(1) β€” that's the pull-request-wrangling page from the Git Extras collection, manual section 1. Grab a snack, we're checking out pull requests and it's gonna be adorable πŸŽ€


✨ NAME ✨

git-pr β€” checks out a pull request locally. that's it. that's the whole job. iconic behavior honestly πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

git-pr [-m|--merge] <number> [<remote>]
git-pr [-m|--merge] <[remote]:number>...
git-pr [-m|--merge] <url>...
git-pr clean

πŸ’… DESCRIPTION πŸ’…

It makes you a local branch based on a GitHub pull request number or URL, and then β€” the way that it just switches you to that branch afterwards β€” chef's kiss. You don't lift a finger. You're just there. 🫢


🌸 OPTIONS 🌸

  • <remote> β€” the name of the remote you wanna fetch from. defaults to origin, as it should. ✨
  • <url> β€” a GitHub pull request URL, and it has to be in this format: https://github.com/tj/git-extras/pull/453. Exactly like that. no freestyling. πŸ™ˆ
  • -m, --merge β€” check out a merge commit against the branch the pull request is targeting. heads up though: this one uses a private API where GitHub checks the pull request's mergeability, so it only works with the opened pull request. and if the merge commit isn't up-to-date? you gotta go visit the pull request web page yourself to trigger the rebuild. annoying but true 😭

🌈 EXAMPLES 🌈

checking out 226 from origin πŸ’–

$ git pr 226

remote: Counting objects: 12, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 12 (delta 3), reused 9 (delta 3)
Unpacking objects: 100% (12/12), done.
From https://github.com/tj/git-extras
 * [new ref]         refs/pull/226/head -> pr/226

Switched to branch 'pr/226'

the * [new ref] line? that's the moment. and then it just puts you on pr/226. slay.

pulling from a different remote 🧚

$ git pr 226 upstream

and this does the exact same thing as the one above πŸ‘†

$ git pr upstream:226

two ways, same vibe. iykyk.

checking out a pull request from a GitHub URL πŸ“

$ git pr https://github.com/tj/git-extras/pull/453

From https://github.com/tj/git-extras
 * [new ref]         refs/pull/453/head -> pr/453
Switched to branch 'pr/453'

multiple pull requests?? yes bestie, we can do that πŸŽ€

via the GitHub URL, or the ID with the remote specified:

$ git pr upstream:226 upstream:443
$ git pr upstream:443 https://github.com/tj/git-extras/pull/453
note that git pr PR-A PR-B is equal to: plain $ git pr PR-A $ git pr PR-B so if one of the pull requests fails to pull, this command will still go ahead and pull the others. the final exit code is decided by the result of the final pulling. one flop β‰  whole flop. πŸ’€

and with --merge you can check out a merge commit πŸ”₯

$ git pr origin:755 --merge
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:tj/git-extras
bf7dd69..de6e51c  refs/pull/755/merge -> pr/755
Switched to branch 'pr/775'

$ git log pr/775 --oneline
de6e51c (pr/755) Merge bf7dd6...

and to clean up old branches 🧹✨

$ git pr clean

Deleted branch pr/226 (was b96a8c2).
Deleted branch pr/220 (was d34dc0f).
Deleted branch pr/775 (was de6e51c).

the way it just cleans house and tells you the old SHA like a lil receipt... obsessed. πŸ‘‘


πŸ‘‘ AUTHOR πŸ‘‘

Originally from https://gist.github.com/gnarf/5406589 β€” shoutout to the original plug. 🫢


🚨 REPORTING BUGS 🚨

found something cursed? tell the world (respectfully) at:


πŸ’œ SEE ALSO πŸ’œ


and that's the whole page bestie, no cap. this was Git Extras, GIT-PR(1), dated May 2026 β€” now go forth and check out your pull requests. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from