Next: Creating Branches, Previous: Pulling / Pushing, Up: Branches
On a centralized version control system, merge changes from another branch into the current VC fileset.
While developing a branch, you may sometimes need to merge in changes that have already been made in another branch. This is not a trivial operation, as overlapping changes may have been made to the two branches.
On a decentralized version control system, merging is done with the
command C-x v m (
vc-merge). On Bazaar, this prompts for
the exact arguments to pass to bzr merge, offering a
sensible default if possible. On Git, this prompts for the name of a
branch to merge from, with completion (based on the branch names known
to the current repository). The output from running the merge command
is shown in a separate buffer.
On a centralized version control system like CVS, C-x v m prompts for a branch ID, or a pair of revision IDs (see Switching Branches); then it finds the changes from that branch, or the changes between the two revisions you specified, and merges those changes into the current VC fileset. If you just type <RET>, Emacs simply merges any changes that were made on the same branch since you checked the file out.
Immediately after performing a merge, only the working tree is modified, and you can review the changes produced by the merge with C-x v D and related commands (see Old Revisions). If the two branches contained overlapping changes, merging produces a conflict; a warning appears in the output of the merge command, and conflict markers are inserted into each affected work file, surrounding the two sets of conflicting changes. You must then resolve the conflict by editing the conflicted files. Once you are done, the modified files must be committed in the usual way for the merge to take effect (see Basic VC Editing).