Resolving Git Merge Conflicts with Ediff

Leonardo Etcheverry has an excellent short post on how to resolve merge conflicts with Magit and ediff. For various reasons, I don’t often encounter merge conflicts so I always struggle with getting them resolved. Etcheverry’s post shows how easy this is using Magit and Ediff.

You get three buffers. One for each of the conflicting files and the third for the merge. You can use 【n】 and 【p】 to move between conflicts and then 【a】 or 【b】 to choose the change. Read the post for the details. The whole process looks easy enough that even the occasional user should be able to remember it.

This entry was posted in Programming and tagged , . Bookmark the permalink.

2 Responses to Resolving Git Merge Conflicts with Ediff

  1. Sarah says:

    Thanks for sharing

  2. Phil says:

    Ediff is pretty great.

    Nowadays I prefer to use it in single-frame mode, rather than having the small pop-up control frame:

    (setq ediff-window-setup-function 'ediff-setup-windows-plain)

    You lose a couple of vertical lines, but there’s never any confusion over frame focus, and if you happen to be running Emacs remotely with a local display (which I do regularly), you’ll find the single frame approach makes ediff’s initialisation dramatically faster.

    If you ever experience issues with your window manager and the control frame, make sure you give the single-frame approach a try.

    I would also strongly recommend the following, if you have a modern widescreen monitor:

    ;; Default to side-by-side comparisons in ediff.
    (setq ediff-split-window-function 'split-window-horizontally)

    Lastly, just remember that typing ? in the control window brings up the expanded help. You don’t need to remember all the bindings — that’s what the help is for, after all — but make sure you at least know what’s available.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>