Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge a branch from another branch in master

Workflow

Following this picture:

  • I create a branch from master (Branch 1)
  • I push 3 commits.
  • I create a pull request on master.
  • Instead of waiting the branch 1 to be merged in master, I create a branch 2 from the branch 1.
  • I push 3 commits, meanwhile the branch 1 as been merged in master with the pull request.
  • I create a pull request for branch 2.

My questions are:

  • In my 2nd pull request, will l have only the 3 commits of the branch 2 or the 6 commits of the branch 1 and 2 ? Indeed, given that the branch 1 has been merged in master its 3 commits are no longer new in branch 2.
  • Same questions for the files changed in branch 1, will they appear in the pull request of the branch 2 even if the branch 1 has been merged in master ?

Hope this is clear enough. Thanks

like image 641
PierBJX Avatar asked Oct 15 '22 14:10

PierBJX


1 Answers

Before the first pull request had been merged in master, the second one featured all commits unknown to master, so yes, all commits of branch1 and branch2.

But now that branch1 is merged into master, the second pull request will only bring the last three commits, those yet unknown to branch1 and master.

So to conclude, if your fear was that you're bringing the same commits twice : no, it won't happen, you're good as it is.

like image 105
Romain Valeri Avatar answered Nov 02 '22 11:11

Romain Valeri