Last Updated: February 25, 2016
·
1.708K
· llabball

Turning an existing GitHub Issue into a Pull Request

Why?

This command attaches code (pull request) to an existing issue.

This prevents:

  • creating a new issue when opening a new pull-request
  • splitting an on-growing discussion from an issue into an pull request issue

Usage?

You can use personal and organization github names and their branches.

git pull-request

  • -i issue-number-without-the-#
  • -b request-to-branch
  • -h request-from-branch

Be sure you are on the right local git repo (git branch) and try a command like the following (replace the githubnames, branchnames and issue number):

git pull-request -i 123 -b defunkt:develop -h defunkt:feature/awesomeness

Installation?

# install on OS X
$ brew install hub

# other systems
$ curl http://defunkt.io/hub/standalone -sLo ~/bin/hub
$ chmod +x ~/bin/hub

# alias it as git
$ alias git=hub

$ git version
git version 1.7.9
hub version 1.8.4 # ← it works!

2 Responses
Add your response

So there is no way to do this without using hub :\ (or otherwise manually performing an api request)

over 1 year ago ·

@thorsummoner of course you don't need to use hub. instead you can talk straight with the github API, (which will prompt for password authentication):

curl --user "johndoe" \
       --request POST \
       --data '{"issue": "123", "head": "defunkt:feature/awesomeness", "base": "defunkt:develop"}' \
       https://api.github.com/repos/defunkt/hub/pulls

See: http://stackoverflow.com/a/4529172/450383

over 1 year ago ·