git-merge-base
Find common ancestor commits for a merge
TLDR
SYNOPSIS
git merge-base [-a | --all] commit commit...git merge-base [-a | --all] --octopus commit...git merge-base --is-ancestor commit commitgit merge-base --independent commit...git merge-base --fork-point ref [commit]
DESCRIPTION
git merge-base finds the best common ancestor(s) between two commits to use in a three-way merge. A common ancestor is "best" if it is not an ancestor of any other common ancestor. One common ancestor that is an ancestor of all best common ancestors is a "merge base".The `--fork-point` option finds where a branch diverged from an upstream branch, taking the reflog into account to handle history rewrites (e.g., after upstream rebase). The `--is-ancestor` option checks if one commit is an ancestor of another, which is useful in scripts for determining commit relationships. The `--independent` option filters a set of commits to only those not reachable from others. For octopus merges (merging more than two branches), the `--octopus` option computes a common base for multiple commits simultaneously.
PARAMETERS
-a, --all
Output all merge bases for the commits, instead of just one.--octopus
Compute the best common ancestors of all supplied commits, in preparation for an n-way merge.--independent
Instead of printing merge bases, print a minimal subset of the supplied commits with the same ancestors. Lists commits which cannot be reached from any other.--is-ancestor
Check if the first commit is an ancestor of the second. Exits with status 0 if true, status 1 if not. Errors are signaled by a non-zero status that is not 1.--fork-point
Find the point at which a branch forked from another reference. Takes into account the reflog of the reference to detect forks from earlier incarnations of the branch (useful after history rewrites).
SEE ALSO
git-merge(1), git-rebase(1), git-log(1), git-branch(1), git-show-branch(1)
