I recently created a "testBranch" branch in one of my GitHub repositories to address multiple issues and create separate pull requests for each of them. I thought that I'd be able to address each issue in separate commits on "testBranch", and then create a PR for each commit linked to that issues. I am unable to do this.
what I did
I created a branch,
testBranch
.I committed some changes on
testBranch
to address one of the issuesI created a pull request for that commit and linked the issue to it.
I made a new commit on
testBranch
to address the next issue.Usually after making a commit, I know that GitHub would check if there are any changes before permitting you to create a PR, but when I click "New Pull Request", this is what shows:
The second commit which I made shows at the bottom, below the
Update README.md
commit. I see "View Pull Request" on the right.
I thought GitHub would compare the changes from the second commit and then let me create a new PR from it. Since I was unable to do that, I resorted to creating multiple branches, one for each individual PR.
I want all this to happen inside one branch, testBranch
. How do I do that?
CodePudding user response:
You cannot create two different open pull requests from the same branch. The branch is already the subject of a pull request. That is why GitHub offers to show you the pull request. You cannot create it; you have already created it.
Further commits on the same branch will be appended to the existing pull request.
Alternatives:
After the pull request is merged, you can add more commits and push to make a new pull request.
Or, create a new branch from your pull request branch, add commits to it, and push it to have two pull requests open simultaneously.