I'm a die-hard emacs
user, but so far have always used kdiff3
for 3-way merges with ancestor, e.g. when performing git merge
or rebase
. I really like the way that kdiff3
can not only simultaneously display all four versions of the text being merged:
- the common ancestor (buffer A in
kdiff3
) - "ours" a.k.a. "local" (buffer B in
kdiff3
) - "theirs" a.k.a. "remote" (buffer C in
kdiff3
) - the merge result or target
but also makes the differences between A, B, and C clear via colour highlighting. However, kdiff3
unsurprisingly sucks in comparison to emacs
when it comes to text editing of the merge buffer, since kdiff3
is not a full-blown text editor. It also doesn't integrate out of the box with the excellent magit
package. So I'm trying to switch to using ediff
when resolving conflicts in this particular scenario (I have been successfully using ediff
for other use cases for many years).
However, despite reading the ediff
manual and EmacsWiki page, and asking on #emacs
IRC, I can't find a way to simultaneously display all 4 buffers. By default it shows:
- "ours" a.k.a. "local" (labelled buffer A)
- "theirs" a.k.a. "remote" (labelled buffer B)
- the merge result or target (labelled buffer C)
Pressing /
switches the window displaying the merge result buffer (C) so that it displays the ancestor buffer, but you can't see the ancestor and the merge result simultaneously. (Also, the diff in the ancestor buffer is highlighted in a single colour which doesn't clearly show which bits differ from the other two visible buffers (A and B), although according to this thread, it seems that unfortunately ancestor diff refinement hasn't been implemented yet.)
Is there an easy way to configure ediff
to simultaneously display all 4 buffers?
git config --global merge.conflictStyle diff3
ensures the ancestor version is also inserted within the conflict range, which seems to be necessary to take advantage of this feature. – Keister