Question

I have two diverged branches J and Z with an arbitrary number of commits:

         .-- a -- b -- ... -- i -- J
        /
... -- o -- x -- b' -- ... -- y -- Z
  1. Is it possible to show, in git log, what commits are in the range of b..i that aren't already cherry-picked into Z?

  2. And, what commits are in the range of b..i weren't cherry-picked into the range of b'..y?

I'm looking for something like git log Z...i --cherry-pick --right-only --no-merges but accepts filtering out ranges.

Edit: I wasn't clear on this, but I'm looking for a way to do this in git log so that I can see them in context by further using options like --cherry-mark and --left-right.

Ideally, a way to write something like git log b..i b'..y --left-right and having b..i treated as left.. (As this seems to be the prerequisite.)

Was it helpful?

Solution 2

You can use ^ to remove commits:

1) git log Z...i --cherry-pick --right-only --no-merges ^a

2) git log y...i --cherry-pick --right-only --no-merges ^a ^x

OTHER TIPS

git cherry is the command you want to use. Take a look at its man page man git cherry. It shows exactly your use case:

           __*__*__*__*__> <upstream>
          /
fork-point
          \__*__*__<limit>__-__+__> <head>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top