Skip to content

Instantly share code, notes, and snippets.

@exu
Forked from legumbre/foo.md
Created November 22, 2012 14:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save exu/4131417 to your computer and use it in GitHub Desktop.
Save exu/4131417 to your computer and use it in GitHub Desktop.
resolving merge conflicts with magit-ediff

Use magit-ediff to resolve merge conflicts

Use magit-ediff or 'e' on an unmerged item to resolve merge conflicts with ediff. Magit will set up an ediff with three buffers A, B and C. A and B are the original (conflicting) files, and C is the conflicted merge.

Use 'n'/'p' to move to the next/previous conflict, use 'a'/'b' to choose which changes (those in a A or B) should be the ones to keep in the merged file.

You can always just switch to buffer C and edit what the merged version should look like.

Once you're done resolving all conflicts, just hit 'q' to exit the ediff merging session, ediff will prompt you to save the changes to the merged file. Save them and then move on to the next unmerged file.

Once you're done, just stage the resolved versions of the files and continue with your merge or rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment