There can be only one open PR from a given branch.
By default, any pull request can be merged at any time, unless the head branch is in conflict with the base branch. However, there may be restrictions on when you can merge a pull request into a specific branch.
Pull requests are based on a branch.
The only way to open up a pull request for multiple commits is:
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 ]
You can create Pull Request(PR), by making separate branches for your work.
Example:
You checkout from a branch master into a branch work-1.
You make some commits in branch work-1 as work-1-commit-1 and work-1-commit-2
Now you create a PR from work-1 to master. Your code can be reviewed by seeing files changed from PR.
Now, for further work you will checkout from branch work-1 into new branch work-2
You make some commits in branch work-2 as work-2-commit-1 and work-2-commit-2
Now you create a PR from work-2 to work-1. Your code can be reviewed by seeing files changed from PR.
Here the files changes will only have the new code you write after work-1-commit-2.
You actually CAN do this without creating another branch, but it takes a bit of playing around.
Here's the steps:
As I see it, the pull request sees commit C as a branch point. Or something.
When you initially go to create the pull request, if you open two separate forms for a new pull request it will allow you to create them as long as they are pointed at different branches to be merged. For example, I could make two separate Requests, one to merge into master and another to merge into test.
I am new to Git and GitHub and had the same question as the OP.
I have found a solution, which probably was not available at the time of the OP.
Situation: You have 3 changes, and you want each to be built off the previous, and each to have their own pull request (PR).
Problem: When you create the first PR that tries to pull develop into master, every thing looks fine, but then after you make the changes for the second PR, and merge them (using the same branch) all the changes are in the same PR.
Mini Solution: Create a new branch
git branch mini_change_2
git checkout mini_change_2
Now you push the code to GitHub and create the PR, but it defaults to Pull from mini_change_2 to master, except master does not yet have the changes from the first PR, so it includes all the changes from PR1 and PR2.
Best Solution: Specify which branch you are merging to in PR2.
Do not just accept the defaults when creating the second PR, say you are going pulling mini_chnage_2 to Develop, this will only show the changes in mini_change_2
Now create a new branch mini_change_3 and PR that to mini_change_3.
The problem comes once you start merging them...but that is a different exercise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With