I have a question on the order with which commits are applied on a merge.

I am merging two branches that have changes on the same text file and
I'd like to ask you about the merge result.

The following output is provided on the two branches to be merged, by
the command:
git show-branch --date-order branchA branchB

! [branchA] file.txt got form A
 * [branchB] file.txt got form B
+  [branchA] file.txt got form A
 * [branchB] file.txt got form B
+  [branchA^] file.txt got form B
+* [branchA~2] First version of file.txt (form A)

Now, this text file alternates between the following contents:

According to form A, file.txt contains only one line of text:

According to form B, file.txt contains three lines of text:

The merge is done with the following commands:
git checkout branchA
git merge branchB

Now, the result of the merge gets file.txt to form B, i.e. it contains
the above 3 lines of text.
My question is, why does the merge have the file resolve to form B and
not to form A ?
Theoretically, the merge could resolve to either A or B form. If the
date is taken into account, maybe the A
could even appear to be a better result.

Thank you in advance and BRs,
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to