5

Let's suppose that we have two branches: master and feature_branch.

Is there a possibility to check if each commit to the feature_branch was cherry-picked into master?

Enrico Campidoglio
  • 56,676
  • 12
  • 126
  • 154
z0nk0
  • 343
  • 2
  • 10
  • The command is [`git cherry`](https://git-scm.com/docs/git-cherry). If you're tracking master and on feature_branch, that's it: `git cherry`. – jthill Dec 09 '22 at 12:10

1 Answers1

6

You can use git-log together with the --cherry-pick and --right-only options for that:

git log --cherry-pick --right-only master...feature_branch

This will return the commits in feature_branch that do not have an equivalent1 commit in master.

From the documentation:

--cherry-pick --right-only A...B omits those commits from B which are in A or are patch-equivalent to a commit in A. In other words, this lists the + commits from git cherry A B.

If there's no output, it means that all the commits in feature_branch have been cherry-picked into master.


  1. Where by equivalent, we mean a commit whose diff is equal ignoring whitespace and line numbers.
Enrico Campidoglio
  • 56,676
  • 12
  • 126
  • 154