How can I divide one pull request into two pull requests? I committed ten times in one pull request, and I want to divide them into two different pull requests because the first six commits are unrelated to the last four commits. I use Ubuntu os with git. As I am new to git, I am wondering how to input git commands step by step to do that. Any advice would be be highly appreciated.
There can be only one open PR from a given branch.
To stack two PRs, checkout the first branch from your base master (or develop ) and push your changes. Create the PR with the base as master . Then, checkout the second branch from the first.
The short answer is "no" but depending on how the branches are related there may be a way to work things so you're guaranteed not to have conflicts after the first merge.
You basically have a duplicate of Splitting a Branch in 2 The graphs there are good so not bothering to duplicate them.
First create a second branch pointing at your sixth commit
git branch branch2 HEAD~4
or
git branch branch2 COMMIT_6_SHA
branch2 is now done and ready to create a pull request for the first 6 commits.
Now you want to use git rebase --onto
to move your existing branch with the other 4 commits so they are hanging off your upstream
git rebase --onto @{u} branch2
And that's it.
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