Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created June 29, 2012 00:14
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save legumbre/3014870 to your computer and use it in GitHub Desktop.
Save legumbre/3014870 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.

@Asalle
Copy link

Asalle commented Mar 5, 2019

God bless you for this.

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