Thoughts on Software and Technology

Turning issues into pull requests

For the past several months, I’ve been using a nice feature that I’ve recently found out that many others don’t know about, so thought I’d draft it up.1

You have an issue in Github, so you do some work, then you issue a pull request to fix that issue. In Github, that means you actually have two issues in your issue list, the original issue, and the pull request. Well, did you know that you can easily turn the issue into a pull request? And it’s easy.

The secret is using the Hub gem. After that’s installed, ‘git pull-request‘ is a commandline option.

Assume I ‘cucumber’ branch, cleaning up the ‘we’re in a pickle!’ issue, which happens to be issue #39. It’s easy to turn “issue 39″ into “pull request 39″ by doing

git checkout -b fix-the-pickle-issue
git commit -m "Make some changes"
git push origin fix-the-pickle-issue
git pull-request -i 39 -b cucumber -h fix-the-pickle-issue

If you’re working on different accounts/origins, you can use fully referenced names:

git checkout -b fix-the-pickle-issue
git commit -m "Make some changes"
git push origin fix-the-pickle-issue
git pull-request -i 39 -b johnmetta:cucumber -h mettadore:fix-the-pickle-issue

The pull request is created on Github, and automatically linked to the issue, turning it from “issue 39″ to “pull request 39″. Of course, you can always close the pull request from the commandline by merging

git checkout cucumber
git merge pull-test
git commit -m "merge"
git push

The pull request is then closed on Github.

  1. realizing, of course, that this is old news to many– as usual []

Comments are closed.

Powered by WordPress | Designed by Elegant Themes