Using emerge in Emacs, I have a session like this:
<<<<<<< variant A
522ADC9C14B2FD9D00F56BAD /* close_test_button.png in Resources */,
522ADC9D14B2FD9D00F56BAD /* [email protected] in Resources */,
522ADCA014B2FDB100F56BAD /* test_failed.png in Resources */,
522ADCA114B2FDB100F56BAD /* [email protected] in Resources */,
>>>>>>> variant B
EC1633C014B2F3E3004B52E7 /* arrow.png in Resources */,
EC1633C114B2F3E3004B52E7 /* [email protected] in Resources */,
EC1633C214B2F3E3004B52E7 /* groups.png in Resources */,
EC1633C314B2F3E3004B52E7 /* [email protected] in Resources */,
####### Ancestor
======= end
I can select variant A or B by hitting a or b on my keyboard, but how do I combine both variants, one after the other?
Just use C-hm within the emerge buffer to see the help for the current modes. As is typical for most modes, the Emerge minor mode displays its key bindings in this help text.
That help shows that you can insert the content of variant A or B with: ia and ib, so you can use that feature to insert whichever variant isn't currently selected.
You can also switch from the default 'fast' mode to emerge 'edit' mode to directly edit the merged text. Use C-cC-cf in edit mode to get back to fast mode (because in edit mode, all emerge commands need to be prefixed by C-cC-c).
The Emerge manual has more details:
M-: (info "(emacs) Emerge")
RET
In particular, it explains the behaviour of the xc binding, which combines the two variants in a single step using a pre-defined template string:
M-: (info "(emacs) Combining in Emerge")
RET
The default template uses C preprocessor conditional syntax, however, so you would almost certainly want to override that. You can set the template via the Emerge Options menu or with emerge-set-combine-template
. For the template syntax see:
C-hv emerge-combine-versions-template
RET
Use the shortcut:
x-c (combine the two versions of the difference)
This will insert the two conflicting regions sequentially, yielding an output something like:
vvvvvvvvvvvvvvvvvvvv
#ifdef NEW
522ADC9C14B2FD9D00F56BAD /* close_test_button.png in Resources */,
522ADC9D14B2FD9D00F56BAD /* [email protected] in Resources */,
522ADCA014B2FDB100F56BAD /* test_failed.png in Resources */,
522ADCA114B2FDB100F56BAD /* [email protected] in Resources */,
#else /* not NEW */
EC1633C014B2F3E3004B52E7 /* arrow.png in Resources */,
EC1633C114B2F3E3004B52E7 /* [email protected] in Resources */,
EC1633C214B2F3E3004B52E7 /* groups.png in Resources */,
EC1633C314B2F3E3004B52E7 /* [email protected] in Resources */,
#endif /* not NEW */
^^^^^^^^^^^^^^^^^^^^
From there, you can go into edit mode (shortcut: 'e') remove the #ifdef macros as necessary to create the final merge that you desire.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With