splitbrain.org

electronic brain surgery since 2001

Automate Github Pull Requests

Pull Requests are a wonderful feature of Github, making managing and accepting patches for your open source project much easier. Recently Github made them even better by adding the option to merge via web interface.

But if you want to try the code before applying, you still need to create a new branch and pull the changes from the requester's branch. It's not complicated but too much to type and copy'n'paste for my taste. Time to automate it.

The new command is called git pull-request and without an argument it lists all open pull requests for the current repository:

Then you can pick a pull request by giving its number:

As you can see, it creates a new branch and pulls the correct branch from the remote repo for you. No need for any manual work, just give it a number and you're good.

And here's the python script doing all the magic. Just install it somewhere in your path.

Update: The code is now available at github.

Tags:
git, github, python, script
Similar posts: