3

As far as I can see I only have the options to pick either A, or B, but not both. I occasionally want to pick both A and B. I know I can just go to the C buffer and edit the file by hand, but it happens often enough that I'd love a key for it. (A different conflict resolution tool I've used in the past, though I cannot remember which, allowed two options: A then B, and B then A.)

An example follows. Let's say I have the following conflict:

fi
fo
fa
fum
<<<<<<< HEAD
foo
=======
bar
>>>>>>> bar
I
like
Bubble
Gum

I would then like an option "A then B" that would yield the following result:

fi
fo
fa
fum
foo
bar
I
like
Bubble
Gum

As extra bonus, I'd love a "B then A" option that would yield the following result:

fi
fo
fa
fum
bar
foo
I
like
Bubble
Gum

PS: I usually invoke emerge from Magit. I'm not sure if this is relevant... Further, I'm on a Mac and I use Emacs 25 pre-test from http://emacsformacosx.com/

0

1 Answer 1

2

There are commands i a and i b which insert a or b; or x c to combine using a template.

For your bonus case you should use a followed by i b.

You can find more about that here.

5
  • This does not work, I'm afraid. a (as expected) inputs foo, but when pressing i b this is replaced by bar: it does not combine the output. Further, xc to combine with a template results in a x is undefined message. Commented Aug 18, 2016 at 12:40
  • 1
    It does, if you really use emerge, as your question suggested. As far as I know magit, however, uses smerge or ediff. They do work differently. You may want to look here for a hint how to use emerge to resolve conflicts.
    – theldoria
    Commented Aug 18, 2016 at 16:07
  • 1
    Btw, the answer to this question may provide a way to solve that problem using ediff.
    – theldoria
    Commented Aug 18, 2016 at 16:17
  • oh gosh, you're right -- I am actually using ediff! Very sorry about that! I'll create a new question to ask what I really had in mind... Commented Aug 19, 2016 at 7:36
  • theldoria thanks, that is exactly the kind of answer I am looking for. I can even get the AthenB / BthenA by swapping the buffers with ~. Thanks a lot! Commented Aug 19, 2016 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.