LinuxCommandLibrary

git-cherry

Find commits not merged upstream

TLDR

Show unpicked commits

$ git cherry [upstream] [branch]
copy
Show with commit messages
$ git cherry -v [upstream]
copy
Compare branches
$ git cherry [main] [feature]
copy

SYNOPSIS

git cherry [options] [upstream] [head]

DESCRIPTION

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.

PARAMETERS

UPSTREAM

Branch to compare against.
HEAD
Branch to check (default: current).
-v
Show commit subjects.
--abbrev N
Abbreviate commit hashes.
--help
Display help information.

CAVEATS

Compares patch content, not commit IDs. Rebased commits show as missing. Works best for linear histories.

HISTORY

git cherry is a core Git command for comparing branches by patch equivalence, named after the cherry-pick operation it helps plan.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community