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.
Written by Leonardo Etcheverry
Related protips
3 Responses
Thanks for the info, it was useful!
Just for reference, I ran into a conflict when trying to merge a branch
into master. The Emacs frame where one has to type 'e' is the
one that contains the buffer magit: <thefilename>, not the
branch manager. The buffer where one has to type 'a' or 'b' is
the small one that pops up. And I had to stage and commit before
I could continue merging.
I use vim and a 'smart' alias https://coderwall.com/p/fc8edq . You could use fugitive.vim and call :Gdiff
once its opened to get the same three way split, but I prefer the default file diff view git provides.
Thanks for sharing. I really love it.