The github documentation indicates how to check a pull request locally :
on the remote repo, a pull request's current "active commit" is stored under refs/pull/<id>/head ; when a merge request is merged, another ref appears at refs/pul/<id>/merge.
Quoting the docs : you can fetch on your local copy an individual merge request :
Fetch the reference to the pull request based on its ID number, creating a new branch in the process.
$ git fetch origin pull/ID/head:BRANCHNAME
You can now compare BRANCHNAME and master(*) to see the list of commits on the merge request :
git log master..BRANCHNAME
git rev-list master..BRANCHNAME
Note that you can choose to fetch the pull/ID/head into some ref other than a branch :
git fetch origin pull/ID/head:refs/remotes/origin/pr/ID
# now the pr appears as 'origin/pr/ID'
(*) if the target branch is not master, you would need to get this information otherwise, from the api for example.
You can also set your refspec to automatically fetch all merge requests ; see for example this gist :
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 = git@github.com: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:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
The next git fetch will download all refs for all pull requests (closed, merged and open together).
I don't see the history of the pull request represented in the refspec :
- you could set up a clone of the repo, whith the above refspec,
- and a hook on github which would notify this clone each time a push is made to a pull request,
- so that the clone would simply run
git fetch origin when notified
That way : the history of the pull request would appear in its reflog :
git reflog origin/pr/<id>
A more direct way : with a hook, you would have access to the commits being pushed, and the pull request being updated, so you can set up something to store the history of that pull request.