The Eclipse Foundation (by the way, you can follow them on Twitter now at @EclipseFdn) is now looking at ways to make it easier to accept GitHub pull requests. I highly recommend you check out this bug if you have any comments on the issue. I think there’s a lot we can do to make the lives of eclipse.org committers easier, along with our community contributors.
Ok, back to the main point of this post. I found a neat trick recently when it comes to accessing GitHub pull requests via the command line. The traditional way is adding a remote that involves the persons repository issuing the pull request (or curling a .patch file via curl https://github.com/repo/pull/123.patch and piping it to git-am). However, it’s as simple as modifying your fetch parameters for the origin repository to include “+refs/pull/*/head:refs/remotes/origin/pr/*” as an option. You can set this optional globally if you like in your git-config as a bonus:
git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
You are now able to easily fetch and checkout pull requests to play with. For example:
$ git checkout pr/123 Branch pr/123 set up to track remote branch pr/123 from origin. Switched to a new branch 'pr/123'
That’s my git tip (or hack) for today, hope you enjoy it!
Comments are closed.