Emacs Tip #5 -- Resolving Merge Conflicts

After performing an update using a version control system, you will sometimes have unresolved conflicts. Often these result in files with the two versions intermingled in a single file. While you can manually delete the unwanted text, emacs provides a better way.

vc-resolve-conflicts provides a rich visual interface to pick which changes should be included in the final merge. It brings up ediff, which lets you pick which version of the code you want to use for each of the changes. In ediff 'n' takes you to the next change, and 'a' or 'b' lets you choose the change from buffer A or B being compared.

So the next time you end up with a file filled with conflict markers you can quickly and easily clean it up to your liking.

Last modified on 19 Apr 2010 by AO

Copyright © 2016 Andrew Oliver