Recently I enabled diff3 and it's much easier to resolve conflict now.
Previously in some cases I had to check the log to see why people did this and that to do the merge. But with diff3 the information is displayed all in one place
<<<<<<< HEAD
THIS IS USEFUL
||||||| merged common ancestors
This is useful
=======
This is really useful
>>>>>>> c2392943.....
From that we can easily see that the result should be "THIS IS REALLY USEFUL"
I wonder if there is any downside to diff3? Why it is not the default behavior of git?
For other readers (and from this article):
This was introduced fairly early (2008), and I suppose it isn't the default, because a default Unix
diff
isn't display as a 3-way diff.With Git 2.35, you also have
zdiff3
("zealous diff3").As mentioned in this thread, if you want to run this command without setting the config, so that you can switch between normal diffs and diff3s easily, this is possible in one specific case:
Note that the
|||||| merged common ancestors
will evolve with git 2.24 (Q4 2019)See commit b657047 (07 Oct 2019), commit 8e4ec33 (01 Oct 2019), and commit 4615a8c, commit 45ef16f, commit f3081da, commit 5bf7e57, commit e95e481, commit a779fb8, commit 8599ab4, commit 7c0a6c8, commit c749ab1, commit bab5687, commit ff1bfa2, commit 4d7101e, commit 724dd76, commit 345480d, commit b4db8a2, commit 98a1d3d, commit 9822175, commit 10f751c (17 Aug 2019) by Elijah Newren (
newren
).(Merged by Junio C Hamano --
gitster
-- in commit 280bd44, 15 Oct 2019)With Git 2.25 (Q1 2020), "
git apply --3way
" learned to honormerge.conflictStyle
configuration variable, like merges would.See commit 091489d, commit aa76ae4, commit 9580620, commit b006968, commit fa87b81 (23 Oct 2019) by Denton Liu (
Denton-L
).(Merged by Junio C Hamano --
gitster
-- in commit eff313f, 10 Nov 2019)