Is merging branch A into B same as merging B into A?

git

Solution

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

Problem

In a git repository, is merging branch A into B same as merging B into A?

Original source