git merge-base --fork-point <ref> 没有产生任何结果

git merge-base --fork-point <ref> is yielding nothing

我在 运行 这个功能分支上:

git fetch origin
git merge-base --fork-point origin/dev; echo $?

git merge-base 命令以 1 退出,但记录零 stdout/stderr。

我不明白为什么 merge-base 命令不会产生 ref,有人知道为什么会这样吗?

torek are part of the git merge-base discussion on fork-point mode提到的注意事项。

         o---B2
        /
---o---o---B1--o---o---o---B (origin/master)
    \                   \
     B0                  D0'--D1'--D' (topic - updated)
      \
       D0---D1---D (topic - old)

A caveat is that older reflog entries in your repository may be expired by git gc.
If B0 no longer appears in the reflog of the remote-tracking branch origin/master, the --fork-point mode obviously cannot find it and fails, avoiding to give a random and useless result (such as the parent of B0, like the same command without the --fork-point option gives).

Also, the remote-tracking branch you use the --fork-point mode with must be the one your topic forked from its tip.
If you forked from an older commit than the tip, this mode would not find the fork point (imagine in the above sample history B0 did not exist, origin/master started at B1, moved to B2 and then B, and you forked your topic at origin/master^ when origin/master was B1; the shape of the history would be the same as above, without B0, and the parent of B1 is what git merge-base origin/master topic correctly finds, but the --fork-point mode will not, because it is not one of the commits that used to be at the tip of origin/master).

您可以看到 git merge-base --fork-point 不起作用的其他情况 in this thread
This patch series 说明当前文档。