为什么 cherry-pick 不接受所有更改?

Why does cherry-pick not take all changes?

我的提交历史中有以下情况:

A1-...-A2
         \
          B1-B2-...-B3----------B4-B5
                      \        /
                       C1-C2-C3

然后我做了(在 git checkout A2 和干净的 git status 之后) git cherry-pick --no-commit C2..B5。 现在,C2file1.txt 中引入了重要的一行,比如

file1.txt
-line x
+line x with new part

和 "line x with new part" 存在于所有提交 C2 到 B5 中。 但是在 cherry-pick 之后,变化没有出现并且 file1.txt 仍然看起来像

...
line x
...

我希望有一行 "line x with new part"。 我想,我不明白这些变化并做到了

git diff HEAD C2 file1.txt
file1.txt
-line x
+line x with new part

这显示了预期的变化。我也检查了 git diff HEAD C3 file1.txtgit diff HEAD B4 file1.txtgit diff HEAD B5 file1.txt 结果相同。

git rev-parse HEAD 按预期结果 A2git status 说“在分支 A 上,您的分支是最新的 'origin/A'。 没有什么可提交的,工作树很干净。

我想念什么?有什么想法吗?

参考文献:
How to cherry pick a range of commits and merge into another branch,
How to merge a specific commit in Git
Pull all commits from a branch, push specified commits to another(我希望, 答案的评论不是问题“......同样,从一个分支到另一个分支的樱桃挑选提交基本上涉及生成补丁, 然后应用它,因此也会以这种方式丢失历史记录。”来自答案。)。

编辑@eftshift0: git cherry-pick --no-commit C1..B5 之后乍一看是正确的:
差异显示

<<<<<<< HEAD
line x                         # current status of A2
||||||| parent of C2...
line x                         # common ancestors of C1 and A2
=======
line x with new part           # from merge (new stuff)
>>>>>>> C2...

来自文档:

git-cherry-pick - Apply the changes introduced by some existing commits SYNOPSIS

DESCRIPTION Given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to be clean (no modifications from the HEAD commit).

因为您说的是 C2..B5,所以不考虑 C2 的变化。试试 C1..B2.