When merging one git branch into another, the common source of merge conflicts is in one of my XML files, where a new (but different) XML was added to the same file insertion point on both branches. In my case, I want git to automatically include the newly inserted XML from both branches in a merged result, and I don't care what changes in the branch are pasted over the other.
Can git be configured for this?
Edit: I found that I can put the line:
*.xml merge=union
To the .gitattributes file - but this does not work as we would like.
Say in my working branch, this XML has been added:
<itemlist id="1"> <item id="1"></item> </itemlist>
And then on the branch that I am going to merge into mine, it was added - in exactly the same place:
<itemlist id="2"> <item id="2"></item> </itemlist>
Then git notices that both sets of changes end with the same text (i.e. a line with an end tag enabled). It seems that since both sides added the same text, it should not duplicate this text in the merge, so it only finishes inserting the following during the merge:
<itemlist id="2"> <item id="2"></item>
Which, of course, leads to invalid XML.
Is there any additional setting that I can do to disable this option "only-merge-changes-that-not-only-changes-in-the-work-branch"?
source share