Skip to content

Instantly share code, notes, and snippets.

@tonini
Created August 27, 2013 09:02
Show Gist options
  • Save tonini/6351308 to your computer and use it in GitHub Desktop.
Save tonini/6351308 to your computer and use it in GitHub Desktop.
Convert a GitHub Issue Into a Pull Request
A little-known-feature of the GitHub API is the ability to attach changes to an issue, converting it into a pull request. The hub command, a wrapper around git that makes it more GitHub aware, allows you to easily do this.
hub pull-request -i 384 -b bkeepers:master -h bkeepers:branch-name
-i is the GitHub issue number
-b is the base, or where you want to send the pull request, with bkeepers being the owner of the repository.
-h is the head, or the branch where your changes live.
Update: in the comments, George Hickman suggests: “as long as you’ve pushed your changes and your local branch is tracking your remote you can exclude the -b and -h options!”. Note that you can set up tracking when pushing with git push -u origin branch-name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment