I have a question for which I couldn't find an answer in Git Pro book.
Suppose I created branchA off master, did some changes, commited and pushed for pull request.
I'm pretty sure that this branch will get merged to origin/master at some point but I want to create branchB off branchA for further development based on submitted change.
Question is what happens with branchB when branchA will get merged?
My take is that if pull request approver merges branchA then my branchB pull request will already contain commits from branchA and diff will effectively show only changes between branchA and branchB
However if it's not yet merged, pull request for branchB will show changes from both branches and it's up to approver to either merge branchA and then branchB or only branchB.
Please correct my reasoning
You had this situation:
branch-A
v
1---2---3---4
/
O---O---O---O
^
master
Then you did this:
branch-A branch-B
v v
1---2---3---4---5---6---7---8
/
O---O---O---O
^
master
To summarize the current state:
If you now decide to complete the pull request for A, you have this scenario:
branch-A branch-B
v v
1---2---3---4---5---6---7---8
/ \
O---O---O---O---------------X
^
master
Where X is now the merge commit. After this, with no other changes or operations, if you revisit the pull request for B it should now (again, still) show the difference between B and master, but now it only includes commits 5-8.
If instead you had completed pull request for B first, you had ended up with this:
branch-A branch-B
v v
1---2---3---4---5---6---7---8
/ \
O---O---O---O-------------------------------Y
^
master
If you now revisit the pull request for A, depending on the tool you would either see an empty diff, or the pull request can be marked as completed (I seem to recall Bitbucket for Enterprise uses this approach), as all changes in A have already been merged successfully.
So to summarize:
TL;DR: Your B-branch is not really affected, but the diff between it and master will initially include all changes from A as well, but after completing PR for A, it will only show diff between B and master, and no longer show the changes from A as they have already been merged. Your paragraph about "My take" is thus spot on.
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