git merge-base finds as good common ancestor(s) as possible 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. That is the merge base. Note that there can be more than one merge base for a pair of commits.
git merge-base <head-branch> <base-branch>