How to pull in patches from foreign repos

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at:


GitHub provides a special pulls remote “namespace” on the upstream repo, so you can add it as a fetch pattern to your .git/config like so:

[remote "upstream"]
url =
fetch = +refs/heads/*:refs/remotes/upstream/*
fetch = +refs/pull/*/head:refs/pull/upstream/*

Then when you `git fetch –all`, you will have ALL pull requests available in your local repo in the local pull/ namespace. To check out PR #42:

git checkout -b foo refs/pull/upstream/42