← 返回命令列表

Linux command

git-cherry 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Show unpicked commits

git cherry [upstream] [branch]

Show with commit messages

git cherry -v [upstream]

Compare branches

git cherry [main] [feature]

说明

git cherry finds commits not yet applied to upstream. It compares commits between branches, identifying which commits from your branch are missing from upstream based on patch content, not commit hashes. Output uses + for commits not in upstream and - for equivalent commits already present. This helps identify what still needs to be merged or cherry-picked. This command is particularly useful for reviewing branch status before merging, ensuring that all intended changes have been integrated and identifying any commits that may have been lost during rebasing.

参数

-v
Show commit subjects.
--abbrev _N_
Abbreviate commit hashes.
--help
Display help information.

FAQ

What is the git-cherry command used for?

git cherry finds commits not yet applied to upstream. It compares commits between branches, identifying which commits from your branch are missing from upstream based on patch content, not commit hashes. Output uses + for commits not in upstream and - for equivalent commits already present. This helps identify what still needs to be merged or cherry-picked. This command is particularly useful for reviewing branch status before merging, ensuring that all intended changes have been integrated and identifying any commits that may have been lost during rebasing.

How do I run a basic git-cherry example?

Run `git cherry [upstream] [branch]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -v do in git-cherry?

Show commit subjects.