Re: [PATCH 1/7] [doc] Add new gitmergeconflicts man page
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 2, 2026, 17:58 UTC
- Message-ID
- <xmqqbj9cvvaa.fsf@gitster.g>
- In-Reply-To
- <xmqqqzia8ohv.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 16 quoted lines
>>>> +FRUITS = [ >>>> + "apple", >>>> +<<<<<<< HEAD >>>> + "cherry", >>>> +======= >>>> + "banana", >>>> +>>>>>>> add-fruit > >> Every time I show people diff3 someone tells me how happy they >> are to learn it :) > > Yes, we should encourage "merge.conflictstyle=diff3" (I feel about > this strongly enough to think it should become the default). > Knowing what the original was before one side wanted to say "cherry" > while the other side wanted to say "banana" sometimes helps a great > deal to decide what to do with the conflict.
Before I forget, here is a good illustration to tell why diff3 style is often essential to correct conflict resolution that we can tell new users. You may want to throw it in to your new manual pages.
If the conflict looks like this
FRUITS = [
"apple",
<<<<<<< HEAD
"cherry",
|||||||
=======
"banana",
>>>>>>> add-fruitthen we can tell that in the beginning there was only 'apple', and one side wanted to add 'cherry', while the other side wanted to add 'banana'. It is likely that we would make both sides happy by adding both of them.
But on the other hand, if the conflict looks like this
FRUITS = [
"apple",
<<<<<<< HEAD
"cherry",
|||||||
"banana",
"cherry",
=======
"banana",
>>>>>>> add-fruitwe can tell that before two sides started editing, we had 'apple', 'banana', and 'cherry'. While both wanted to keep 'apple', one side did not want 'banana', and the other side did not want 'cherry'. It is plausible that we can please both of them by removing these two.
With just two-sides, the user who is trying to resolve the conflict cannot tell the difference.