Report diffs of changes on a branch since it diverged from another
(vc-diff-mergebase).
Display log messages for revisions on a branch since it diverged from
another (vc-log-mergebase).
The merge base of two branches is the most recent revision that exists on both branches. If neither of the branches was ever merged into the other (see Merging Branches), then the merge base is the revision that the older of the two branches was at when the newer branch was created from it (see Creating New Branches). If one of the branches was ever merged into the other, then the merge base is the most recent merge point.
The commands described in this section are currently implemented only for decentralized version control systems (see Decentralized vs Centralized Repositories).
Merge bases are useful to make certain comparisons between branches, and
Emacs provides two commands for doing so. Each of C-x v M D
(vc-diff-mergebase) and C-x v M L (vc-log-mergebase)
prompts for two branches, finds their merge base, and then compares that
merge base with the second of the two branches. The commands report
diffs and display change history, respectively.
The typical use case for these commands is when one of the branches was originally created from the other and you or a collaborator have made merges of one of the branches into the other at least once. Then you can use these commands to see what changes on one branch have not yet been merged into the other.
Call the branch which has the changes you are interested in the “source branch” and the branch into which these changes have not yet been merged the “target branch”. Specify the target branch when prompted for the “older revision” and the source branch when prompted for the “newer revision”.20 Then C-x v M D shows you a preview of what would change on the target branch if you were to merge the source branch into it, and C-x v M L shows you a log of the changes on the source branch not yet merged into the target branch.
The concept of merge bases generalizes from branches to any two revisions. The merge base of two revisions is the most recent revision that can be found in the revision history of both of the two revisions. C-x v M D and C-x v M L accept any two revisions, not just branches. Comparing two branches is the same as comparing the revisions at the ends of the branches.
(In fact the concept generalizes to any number of revisions, but Emacs’s commands for merge bases work with only two, so we limit ourselves to that.)