I’ve created a simple tool for landing pull requests from Github, which I’m calling “Pulley“.
Landing a pull request from Github can be annoying. You can follow the instructions provided by Github (pulling the code, doing a merge) but that’ll result in a messy commit stream and external ticket trackers that don’t automatically close tickets. The series of commands that you run will typically look something like this:
git checkout -b branchname master git pull http://url/to/otherrepo branchname git checkout master git merge branchname git push origin master
Additionally you can pull the code and squash it down into a single commit, which lets you format the commit nicely (closing tickets on external trackers) – but it fails to properly close the pull request. The commands for which look something like this:
git checkout master git checkout -b bug1234 git pull http://url/to/otherrepo branchname git checkout master git merge --no-commit --squash bug1234 git commit -a --author="Original Author
" # To get the author: git log | grep "Author" | head -1
Pulley is a tool that uses the best aspects of both techniques. Pull requests are pulled and merged into your project. The code is then squashed down into a single commit and nicely formatted with appropriate bug numbers and links. Finally the commit is pushed and the pull request is closed with a link to the commit.
Pulley is written using Node.js – thus you’ll need to make sure that you have Node installed prior to running it.
How to use:
Download a copy of Pulley or install it via npm:
npm install pulley and configure the repo and bug tracker details in the pulley.js file (this is only necessary if you use a custom, non-Github, issue tracker).
You’ll also need to set up your Github username and token into your Git repo. More details can be found in the Github docs.
Once that’s complete you can run the following command:
node pulley.js PID # Where PID is the Pull Request ID
For example running the command
node pulley.js 332 on the jQuery repo yielded the following closed pull request, commit, and tickets:
The configuration is still a bit janky but it works well enough for me – I’m looking forward to landing a few pull requests to improve it.