(emacs)Overview of Emerge
Next: Submodes of Emerge Up: Emerge
Overview of Emerge
To start Emerge, run one of these four commands:
Merge two specified files.
Merge two specified files, with reference to a common ancestor.
Merge two buffers.
Merge two buffers with reference to a common ancestor in a third
The Emerge commands compare two files or buffers, and display the
comparison in three buffers: one for each input text (the "A buffer"
and the "B buffer"), and one (the "merge buffer") where merging takes
place. The merge buffer shows the full merged text, not just the
differences. Wherever the two input texts differ, you can choose which
one of them to include in the merge buffer.
The Emerge commands that take input from existing buffers use only
the accessible portions of those buffers, if they are narrowed (*note
If a common ancestor version is available, from which the two texts
to be merged were both derived, Emerge can use it to guess which
alternative is right. Wherever one current version agrees with the
ancestor, Emerge presumes that the other current version is a deliberate
change which should be kept in the merged version. Use the
`with-ancestor' commands if you want to specify a common ancestor text.
These commands read three file or buffer names--variant A, variant B,
and the common ancestor.
After the comparison is done and the buffers are prepared, the
interactive merging starts. You control the merging by typing special
commands in the merge buffer. The merge buffer shows you a full merged
text, not just differences. For each run of differences between the
input texts, you can choose which one of them to keep, or edit them both
The merge buffer uses a special major mode, Emerge mode, with
commands for making these choices. But you can also edit the buffer
with ordinary Emacs commands.
At any given time, the attention of Emerge is focused on one
particular difference, called the "selected" difference. This
difference is marked off in the three buffers like this:
TEXT THAT DIFFERS
Emerge numbers all the differences sequentially and the mode line
always shows the number of the selected difference.
Normally, the merge buffer starts out with the A version of the text.
But when the A version of a part of the buffer agrees with the common
ancestor, then the B version is preferred for that part.
Emerge leaves the merged text in the merge buffer when you exit. At
that point, you can save it in a file with `C-x C-w'. If you give a
prefix argument to `emerge-files' or `emerge-files-with-ancestor', it
reads the name of the output file using the minibuffer. (This is the
last file name those commands read.) Then exiting from Emerge saves the
merged text in the output file.
If you abort Emerge with `C-]', the output is not saved.
automatically generated by info2www