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 project that I was submitting it to. I tried it again recently and it didn't work -- it just created a brand new issue instead. I don't see any options like "Attach to issue" on the new pull request page, nor "Open a new pull request for this issue" on the issue page. Is there any way to do this, to help project owners keep their Issues page clean and avoid duplication?
Edit: To clarify, I know that creating a pull request always creates a new issue. I would like to instead attach the pull request to an existing issue.
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.
in case you use 2-factor-auth with github you'll need to provide the authtoken as header in the request:
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:
This will create a new branch issue-123. Once you're done working on the issue, execute:
Voila!
Note: I am the author of Gub gem.
You can create a Pull Request from an existing Issue with the Pull Request API:
This creates a pull request:
technoweenie
at projectfaraday
(https://api.github.com/repos/technoweenie/faraday/pulls)synchrony
branch insmparkes
' fork ("head": "smparkes:synchrony")master
branch intechnoweenie
's fork ("base": "master")smparkes
(--user "smparkes")Another possible tool is the Issue2Pr website which turns your issues into Pull Requests.
It's very simple and effective!
Resources:
This other answer explains how to use cURL (
curl
) to create a Pull Request from an Issue through the GitHub API. Here’s how to do it using HTTPie (http
), which produces an easier-to-read and easier-to-edit command:Then type your GitHub password when prompted.
Explained example
You have logged into GitHub with username smparkes and password hunter2. You saw technoweenie’s repo faraday, thought of something that should be changed, and made an Issue on that repo for it, Issue #15. Later, you find that nobody else has made your proposed change, and you also have some time to do it yourself. You fork faraday to your own account, then write your changes and push them to your fork under a branch named synchrony. You think technoweenie should pull those changes to the master branch of his repo. This is the command you would write to convert your previous Issue into a Pull Request for this situation:
Now Issue #15 is a Pull Request.