git 中最近的共同祖先可以是模棱两可的吗?

Can the most recent common ancestor in git be ambiguous?

既然修订可以有多个父项(合并)和多个子项,那么 "most recent common ancestor" 不能有歧义吗?

例如:

A---B--C--D                                                                                                                                               
 \   \   /
  \   E /
   \ / /
    F-G

E 和 D 最近的共同祖先可能是 B 或 F。

我尝试在 git 中复制它,我认为它给了 B 作为共同祖先。这里有选择 B 而不是 F 的理由吗?也许求助于时间戳?或者它只是算法发现的第一个共同祖先,这将是一个任意的实现细节?

这不仅仅是可能的,documentation for git merge-base中提到了它:

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.

[强调我的——我认为强调的句子应该包括"best"这个词,真的],并且:

... Neither one is better than the other (both are best merge bases). When the --all option is not given, it is unspecified which best one is output.

(这意味着,正如您所建议的,这是一个实现细节)。