Skip to content

Instantly share code, notes, and snippets.

View JustinWhite814's full-sized avatar

Justin JustinWhite814

View GitHub Profile
@JustinWhite814
JustinWhite814 / pr.md
Created December 5, 2022 15:05 — forked from patgarcia/pr.md
Fetch all GitHub pull requests to local tracking branches

NOTE

You may not need local branches for all pull requests in a repo.

To fetch only the ref of a single pull request that you need, use this:

git fetch origin pull/7324/head:pr-7324
git checkout pr-7324
# ...
@JustinWhite814
JustinWhite814 / pr.md
Created March 12, 2022 16:13 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: