table of contents
other versions
- wheezy 1:1.7.10.4-1+wheezy3
- wheezy-backports 1:1.9.1-1~bpo70+2
- jessie 1:2.1.4-2.1+deb8u2
- jessie-backports 1:2.11.0-3~bpo8+1
- testing 1:2.11.0-3
- unstable 1:2.11.0-4
- experimental 1:2.13.1+next.20170610-1
GIT-MERGE-BASE(1) | Git Manual | GIT-MERGE-BASE(1) |
NAME¶
git-merge-base - Find as good common ancestors as possible for a mergeSYNOPSIS¶
git merge-base [-a|--all] <commit> <commit>... git merge-base [-a|--all] --octopus <commit>... git merge-base --independent <commit>...
DESCRIPTION¶
git merge-base finds best common ancestor(s) between two commits to use in a three-way merge. One common ancestor is better than another common ancestor if the latter is an ancestor of the former. A common ancestor that does not have any better common ancestor is a best common ancestor, i.e. a merge base. Note that there can be more than one merge base for a pair of commits.OPERATION MODE¶
As the most common special case, specifying only two commits on the command line means computing the merge base between the given two commits.Compute the best common ancestors of all
supplied commits, in preparation for an n-way merge. This mimics the behavior
of git show-branch --merge-base.
--independent
Instead of printing merge bases, print a
minimal subset of the supplied commits with the same ancestors. In other
words, among the commits given, list those which cannot be reached from any
other. This mimics the behavior of git show-branch --independent.
OPTIONS¶
-a, --allOutput all merge bases for the commits,
instead of just one.
DISCUSSION¶
Given two commits A and B, git merge-base A B will output a commit which is reachable from both A and B through the parent relationship.o---o---o---B / ---o---1---o---o---o---A
o---o---o---o---C / / o---o---o---B / / ---2---1---o---o---o---A
o---o---o---o---o / \ / o---o---o---o---M / / ---2---1---o---o---o---A
---1---o---A \ / X / \ ---2---o---o---B
SEE ALSO¶
git-rev-list(1), git-show-branch(1), git-merge(1)GIT¶
Part of the git(1) suite03/19/2016 | Git 1.7.10.4 |