I'm trying to make sense of a puzzling behavior with git union merge. To repro, start with a hello.txt that has:
1
2
3
In another commit, add a line, e.g.
1
2
new
3
In a different foo
branch off of the original commit, delete the middle line:
1
3
Here I would expect the merge to not contain the deleted line, even when using union merge. Yet I see it contain (after running git merge foo
while on master.):
1
2
new
3
So it's ignoring my line deletion. Am I just misunderstanding how union merge works? Sample repo here: https://github.com/davidebbo/MergeTest
One more note: if instead of deleting line 2, you delete line 1, then the merge happens as expected, ending up with:
2
new
3
So the weirdness only seems to occur in scenarios that would cause conflicts under standard (non-union) merge.
The --union merge is working just as it should. See the git-merge-file man page:
Instead of leaving conflicts in the file, resolve conflicts favouring both side of the lines.
The the second scenario does not count as a conflict at all. The modified lines are not adjacent (#1 and #3).
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