Say I have an XML file on master:
<entity>
<field id="name" type="string"/>
<field id="tel" type="string"/>
</entity>
Now Jean creates branch J, the purpose of which is to handle the postal address, and Bob creates branch B, the purpose of which is to handle the email address.
So Jean changes the file to:
<entity>
<field id="name" type="string"/>
<field id="tel" type="string"/>
<field id="address" type="string"/>
</entity>
And Bob changes the file to:
<entity>
<field id="name" type="string"/>
<field id="tel" type="string"/>
<field id="email" type="string"/>
</entity>
For the purpose of this question, let’s ignore the accompanying code (Java stuff…).
My question is about the merge of those two evolutions. A simple git merge shows both 3rd <field…> side-by-side, as a conflict on the same line, even though these lines do not share a common ancestor (like, eg., if I had changed the 2nd <field…> differently on both branches).
I would like to automatically obtain a merged file with 4 <field…> lines, without conflicts.
I understand that such a merge would be dangerous as a default because in many cases, this is not safe. But when I know that in my situation it is safe, is there a way to tell git to just take everything that is new from both sides?