git cherry 和 git log --cherry 命令之间的区别
Differences between git cherry and git log --cherry commands
git cherry develop feature/ABC
- 1014d04c60efccb5d0b8762af1371831bb234b17
git cherry 命令正确显示提交 1014d04
(标记为 -
)可以在针对开发的变基过程中从功能分支中删除。因为它已经被挑选出来开发了。
但是git log cherry 命令似乎不起作用(标有+)
git log --cherry --oneline develop..feature/ABC
+ 1014d04 adding some comment
git log --cherry-mark --oneline develop..feature/ABC
+ 1014d04 adding some comment
我在
git --version
git version 2.12.0.windows.1
--cherry-mark
和 --cherry
选项实际上要求您进行对称差分。这从 --cherry
:
的描述中看得更清楚
--cherry
A synonym for --right-only --cherry-mark --no-merges
; useful to limit the output to the commits on our side and mark those that have been applied to the other side of a forked history with git log --cherry upstream...mybranch
, similar to git cherry upstream mybranch
.
注意这里的三个点,它调用了对称差分代码。这需要在任一分支上的提交,但不在两个分支上的提交,即,它排除了它们的合并基础和任何祖先提交。因此,选定的提交必须只能从左侧的 ID(在本例中为 upstream
)或右侧的 ID (mybranch
) 访问,但不能同时访问两者。 --left-right
选项将每个提交标记为 "leg" 到达它,而 --right-only
丢弃选定的左侧提交,但只有 after 等效提交已标记。
( 是 可以在没有 --left-only
或 --right-only
的情况下使用 --cherry-mark
,但它没有那么有用,我认为:你不能告诉提交来自哪一方。将 --cherry-mark
与 --left-right
混合使用 left/right 标记 (!)
替换樱桃标记
git cherry develop feature/ABC
- 1014d04c60efccb5d0b8762af1371831bb234b17
git cherry 命令正确显示提交 1014d04
(标记为 -
)可以在针对开发的变基过程中从功能分支中删除。因为它已经被挑选出来开发了。
但是git log cherry 命令似乎不起作用(标有+)
git log --cherry --oneline develop..feature/ABC
+ 1014d04 adding some comment
git log --cherry-mark --oneline develop..feature/ABC
+ 1014d04 adding some comment
我在
git --version
git version 2.12.0.windows.1
--cherry-mark
和 --cherry
选项实际上要求您进行对称差分。这从 --cherry
:
--cherry
A synonym for
--right-only --cherry-mark --no-merges
; useful to limit the output to the commits on our side and mark those that have been applied to the other side of a forked history withgit log --cherry upstream...mybranch
, similar togit cherry upstream mybranch
.
注意这里的三个点,它调用了对称差分代码。这需要在任一分支上的提交,但不在两个分支上的提交,即,它排除了它们的合并基础和任何祖先提交。因此,选定的提交必须只能从左侧的 ID(在本例中为 upstream
)或右侧的 ID (mybranch
) 访问,但不能同时访问两者。 --left-right
选项将每个提交标记为 "leg" 到达它,而 --right-only
丢弃选定的左侧提交,但只有 after 等效提交已标记。
( 是 可以在没有 --left-only
或 --right-only
的情况下使用 --cherry-mark
,但它没有那么有用,我认为:你不能告诉提交来自哪一方。将 --cherry-mark
与 --left-right
混合使用 left/right 标记 (!)