In a git repository, is merging branch A into B same as merging B into A?
To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch. This example merges the jeff/feature1 branch into the main branch.
When you perform a merge, you effectively merge one branch into another—typically a feature branch or bug fix branch into a main branch such as master or develop. Not only will the code changes get merged in, but also all the commits that went into the feature branch.
No, merging does only affect one branch.
Usually it does not matter if both branches are topic or feature branches. However, if you have an integration branch or a branch that marks what's been published, you definitely want to use the long lived integration branch as the one that's checked out and merge the other one into it.
No, if you merge A into B, then in the end branch A will only have A's changes, and B will have both A+B changes.
If you merge B into A, then A with have both A+B changes, and B will only have B's changes.
Start:
/A1-A2-A3 X \B1-B2-B3
A to B with a merge commit:
/A1-A2-A3 X \B1-B2-B3-A*(1,2,3)
A to B with fast forward:
/A1-A2-A3 X \A1-A2-A3-B1'-B2'-B3'
B to A with merge commit:
/A1-A2-A3-B*(B1,B2,B3) X \B1-B2-B3
B to A with fast forward:
/B1-B2-B3-A1'-A2'-A3' X \B1-B2-B3
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