1

Let's start with master branch

m1 -> m2 -> m3

We create a branch now. Add b1 and b2, so my branch looks like this

m1 -> m2 -> m3 -> b1 -> b2

Now master gets 2 more added

m1 -> m2 -> m3 -> m4 -> m5

I cherry pick those 2 in my branch

m1 -> m2 -> m3 -> b1 -> b2 -> m'4 -> m'5

Master has m6 and m7 added.

m1 -> m2 -> m3 -> m4 -> m5 -> m6 -> m7

Now, I want to see everything in master that's not in branch. Easy syntax

git log --oneline master ^branch

I want the above to only show m6 and m7

Why, because m4 already shows up in my branch (except it shows up as m'4 because of the cherry pick) and m5 already shows up in my branch (except it shows up as m'5 because of the cherry pick)

I understand cherry-picks have different hashes, but is there a way for git log to somehow identify that m4 == m'4 and m5 == m'5 and therefore when I ask "what's in master that's not in my branch" , it hides those 2?

None of the --cherry-mark, --cherry, --cherry-pick seem to do what I want.

Hari Sundararajan
  • 608
  • 2
  • 8
  • 18
  • 1
    Does this answer your question? [Git log list commits excluding cherry-picked from the first branch](https://stackoverflow.com/questions/56297349/git-log-list-commits-excluding-cherry-picked-from-the-first-branch) – Joe Sep 17 '21 at 10:11
  • whoa , there seems to be a wealth of information in that page. While there seems to be no direct way to get what I need, maybe I can script something with the info from that page. Thank you! – Hari Sundararajan Sep 17 '21 at 10:49
  • I *think* you want `git log branch...master --cherry`; but yes, there's a lot. – Joe Sep 17 '21 at 11:29
  • You're right that there's no *direct* way to get what you want, but it's pretty easy to script once you understand the cherry marking system. You'll probably want to use `git rev-list`, fix up the hash ID list, and then run `git log --stdin --no-walk` with the commit hash IDs fed from stdin. – torek Sep 17 '21 at 19:41

0 Answers0