Merging adjacent deleted lines?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Say I have a file that started out with the following content :

line1
line2
line3
line4


I create a branch, which deletes line2.  Someone else's branch deletes line 3.

When I merge those two branches, the conflict looks like :

line1
<<<<<<< HEAD:lines
line3
=======
line2
>>>>>>> SomeoneElse:lines
line4



Which in my cursory overview, looked an awful lot like the obvious
merge resolution ought to be

line1
line3
line4

After all - I know I want to delete line 2, and wasn't aware of the
other person deleting line 3.

It was only later that we discovered that the merge was broken and
both lines should have been deleted.  Thinking about it, I guess that
the conflict if the other branch _hadn't_ deleted line 3 would have
looked something like

line1
<<<<<<< HEAD:lines
=======
line2
>>>>>>> SomeoneElse:lines
line3
line4

 - which wouldn't have resulted in a conflict anyway.


So, it looks like I need to be way more careful when merging
conflicts.  Which leads me to - what tools do you use when studying
conflicts like that?  git blame seems the obvious one, for getting the
context of each deletion, but it seems like I need to run it once as
git blame HEAD lines, and once as git blame MERGE_HEAD lines.  Is
there something a little more integrated for comparing the origin of
each change from both merge branches simultaneously?

Would welcome any thoughts on how you guys approach conflict-resolution
-Jon
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux