brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: git cherry -v shows which of your commits are not upstream yet

Git
~/tips/tip-git-cherry-unmerged-commits

git cherry -v main

Compares commits by their patch, so cherry-picked copies count as already merged.

A plain commit range can’t see that a commit was cherry-picked or rebased onto main under a new hash. git cherry compares the changes themselves.

git cherry -v main

Run on your branch, this lists the commits that aren’t on main yet, one per line. A + means the change isn’t upstream. A - means a commit with the same patch already exists on main, even if it has a different hash. -v adds the subject so you know which commit is which:

+ ee66d74 Add export button
- 3f0dfd6 Fix typo in footer

Here the typo fix already landed on main through a cherry-pick, so only the export button is still waiting. You can name both sides too: git cherry -v main feature.

I find it most useful after a maintainer applied part of your branch by hand, or when you keep a backport branch next to main. Everything with a minus can usually go before you rebase.

The match uses the patch ID, which ignores whitespace and line numbers but not real edits. If someone tweaked your commit while picking it, even by one word, the changed copy counts as different and you still get a plus. So a plus means “not found in this exact form”, not “missing”.

Further reading: git-cherry documentation

More Git tips git show-branch main feature git log --stat -5 git merge --no-ff feature -m "Merge feature" git merge --squash feature git merge --abort All Git tips (144) All topics

Link