How do you attach a new pull request to an existing issue on github?

前端 未结 10 1892
抹茶落季
抹茶落季 2020-12-04 04:40

I\'m not sure, but I have a vague memory of creating a github pull request with \"Issue 4\" or something in the title, and it automatically attached itself to Issue 4 in the

相关标签:
10条回答
  • 2020-12-04 04:59

    Adding a pull request to an existing upstream issue is easy assuming you forked using the normal github means.

    Simply reference the issue in your commit message using any of the supported keywords:

    • close
    • closes
    • closed
    • fix
    • fixes
    • fixed
    • resolve
    • resolves
    • resolved

    For example: "this commit fixes #116"

    The text referencing the issue does not need to appear in the subject line of your commit.

    Push your commit to your github repo and the pull request will be automatically appended to the issue.

    Note: While it is not required, it is strongly recommended that you commit anything that will be part of a pull request to a separate branch specific to that issue, because future commits on that branch will be appended to the pull request (automatically by github). So, if you didn't make a separate branch, left it on master, and then kept developing, then all your unrelated commits to master would get appended to your pull request.

    0 讨论(0)
  • 2020-12-04 04:59

    You may also use Gub to submit pull requests for your issue.

    It also helps you use a proper fork/pull-request style.

    Edit: 10/5/2013

    To get Gub to submit pull-request for issue #123, you need to run the following:

    $ gub start 123
    

    This will create a new branch issue-123. Once you're done working on the issue, execute:

    $ gub finish
    

    Voila!

    Note: I am the author of Gub gem.

    0 讨论(0)
  • 2020-12-04 05:01

    Using the git-hub tool, you could do this with:

    $> git hub pull attach 123

    This would convert issue #123 into pull request #123, thus maintaining all discussion about the issue in a single location.

    0 讨论(0)
  • 2020-12-04 05:08

    If you have 2FA enabled, you can use pass the token with HTTPie:

    http POST \
        https://api.github.com/repos/<repo-owner>/<repo-name>/pulls \
        issue=2 head=issue_2 base=master
        "Authorization:token PUTAUTHTOKENHERE"
    

    This will use the branch issue_2 to convert issue #2 into a pull request.

    0 讨论(0)
提交回复
热议问题