Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New pull request when one is already opened

I've created pull request to project from my fork branch. Repo owner will accept it after code review but it can wait a while because he is currently busy. I didn't want to wait and on brand new branch in my fork I implemented next features.

If now I create new pull request will it merge with previous and create one huge pull request? Or there will be two separate PR? I'm worried it will merge because in commits field on GH I see commits from previous PR.

like image 402
BT101 Avatar asked Dec 23 '25 00:12

BT101


1 Answers

Figure out the following

                  ___ you created a new branch, call it "branch-01" 
                 /       
master branch __/_______________________

now it depends how you did move on from there and how you did want to move on from there cause there are 2 different scenarios.

Scenario 1: You created a PR branch-01 which contains a few commits containing all the work which needs to be merged back to master. But needs a review so it's like on hold.

Scenario 2: You created a PR branch-01 which contains a few commits containing some work. Now you need those changes to continue the next work. So what you do now is if you are on branch-01 you do git checkout -b branch-01-next-steps now the branch branch-01-next-steps will have the previous work from branch-01 because you created a new branch from there. So this branch is on top of branch-01, looking like so

                                    ______branch-01-next-steps______
                                   /
                  ____branch-01___/ 
                 /       
master branch __/_______________________

Maybe that's what you want and need. But maybe you need a "fresh" new branch from master. What you have to do then is first git checkout master now you are on your local master branch. From there you can do git checkout -b next-steps which will then look like

                  __branch-01..(waiting)              ___next-steps
                 /                                   / 
master branch __/___________________________________/________

if you need to get changes from master which have been merged on remote before you start working on next-steps you have first to go to master git checkout master then type git pull origin master and then git checkout -b next-steps now next-steps will contain the newest changes from remote master.

You can always go back to branch-01 with git checkout branch-01

like image 164
caramba Avatar answered Dec 24 '25 12:12

caramba



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!