This scripts will find all github remotes in the current repository and add a new configuration that allows you to fetch pull request heads
and merge-heads
+refs/pull/*/head
+refs/pull/*/merge
$ cd git-repo
$ git gh-setup
adding refs/pull/* to origin
# Now, attempt a fetch from github
$ git fetch
From git@github.com:chernjie/git-gh-setup
* [new ref] refs/pull/1/head -> origin/pull/1/head
* [new ref] refs/pull/1/merge -> origin/pull/1/merge
* [new ref] refs/pull/2/head -> origin/pull/2/head
* [new ref] refs/pull/2/merge -> origin/pull/2/merge
# Take a look at your logs
$ git log --oneline --decorate --graph --all