Used to detect what you've already cherry-picked upstream.
git cherry tells you which commits on your branch are NOT yet in upstream, marking with '+' the ones still missing and '-' the ones whose patch-id is already there (typically because they were cherry-picked or rebased upstream).
It's a patch-id comparison: same diff content => same commit, even with different SHAs. Pairs naturally with git patch-id under the hood.
git cherry [-v] [--abbrev[=<n>]] [<upstream> [<head> [<limit>]]]| Flag | What it does |
|---|---|
<upstream> | Branch you're comparing against; default is the upstream of HEAD. |
<head> | Branch whose commits to classify; defaults to HEAD. |
<limit> | Stop walking before this commit (exclusive). |
-v | Verbose: also print the commit subject after each marker. |
--abbrev[=<n>] | Show abbreviated SHAs of length <n> instead of full 40 chars. |
git cherry -vgit cherry -v main topicgit cherry -v --abbrev=8 maingit cherry main topic v1.2.0Hit each option, then Check answers. Score is recorded; Next is always open.