GIT: 寻找补丁分支的连接点

GIT: Find junction point for patch branch

我正在寻找一种方法来找到 2 个以上分支的最近共同祖先提交,以找到补丁分支的理想交汇点。
关于“补丁分支”,我的意思是:https://devblogs.microsoft.com/oldnewthing/20180314-00/?p=98235

我为此找到了 2 个命令:

git show-branch --merge-base branch1 branch2 ... branchN
git merge-base --octopus branch1 branch2 ... branchN

它们有什么区别:

文档说:

https://git-scm.com/docs/git-show-branch#Documentation/git-show-branch.txt---merge-base

--merge-base
Instead of showing the commit list, determine possible merge bases for the specified commits. All merge bases will be contained in all specified commits. This is different from how git-merge-base[1] handles the case of three or more commits.

https://git-scm.com/docs/git-merge-base#Documentation/git-merge-base.txt---octopus

--octopus
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.

git show-branch --merge-basegit merge-base --octopus 做的完全一样吗?
哪一个命令可以安全地找到补丁分支的连接点?

git show-branch --merge-basegit merge-base 不同,因为当使用 git show-branch 时,所有 merge-bases 将包含在所有指定的提交中。

--merge-base
Instead of showing the commit list, determine possible merge bases for the specified 
commits. All merge bases will be contained in all specified commits. This is different 
from how git-merge-base[1] handles the case of three or more commits.

https://git-scm.com/docs/git-show-branch

如果指定了两个以上的提交,香草 git merge-base 给出的合并基础不一定包含在每个提交参数中,这与 git show-branch 方法不同。但是,如果 --octopus 作为参数提供,它确实模仿了 git show-branch --merge-base.

的行为

所以这两个命令应该提供相同的输出。