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.
            Asked
            
        
        
            Active
            
        
            Viewed 1.0k times
        
    1 Answers
14
            
            
        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.
 
     
     
    