问题
When I open a pull request on GitHub.
All commits since my last request and all new ones are automatically added to this request.
I can't seem to control which commits are added and which are not.
When I try to open another pull request, I get an "Oops! There's already a pull request" error.
Is there any easy way to open multiple pull requests without having to mess around with the command line?
回答1:
Pull requests are based on a branch.
The only way to open up a pull request for multiple commits is:
- Isolate them into their own branch.
- Open the pull requests from there.
回答2:
The easiest way I've found to do this is with the hub command (https://github.com/defunkt/hub).
From your topic branch ("feature" in this example) that you want to create a pull request for, you can just run:
git pull-request
(remember to push your branch first!)
And it will open a new pull request on GitHub for "YOUR_USER:feature".
If you've already created an issue on GitHub, you can even attach a pull request to that existing issue (something you can't do from the web UI):
$ git pull-request -i 123
[ attached pull request to issue #123 ]
回答3:
You actually CAN do this without creating another branch, but it takes a bit of playing around.
Here's the steps:
- Identify the two commit ranges you want to pull. Here's what i'll use for an example:
(other/master) A -> B -> C -> D -> E (yours/master)
Let's say that you want to pull B and C in one request, and D & E in another. - Make a pull request. Have the left side ("Base") be commit A. For the right side ("head"), type in the commit number of C.
- Write the description for your first request.
- Make another request. For the base, type in the commit number of C, and for the head, put E (yours/master).
- Write the description.
As I see it, the pull request sees commit C as a branch point. Or something.
来源:https://stackoverflow.com/questions/8450036/how-to-open-multiple-pull-requests-on-github