# Getting a list of commits between 2 points without upstream changes

4 messages from 2011-07-17 to 2011-07-18. Participants: Chris Packham, Jeff King.
Thread: https://gitlist.dev/t/27836

## Chris Packham, 2011-07-17 23:49

Subject: Getting a list of commits between 2 points without upstream changes
Message-ID: <CAFOYHZC5hQ9JV8a5d20AaPR_eYFDViama+4148MPumvvJ-n6wQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAFOYHZC5hQ9JV8a5d20AaPR_eYFDViama%2B4148MPumvvJ-n6wQ%40mail.gmail.com

```
Hi List,

I'm trying to send round an incremental changelog for my project which
contains just my changes without changes that have been made upstream.
The history look something like this.

---o--o--o--o--o--o--o--o-- upstream
    \          \        \
     \-m--A--m--B--m--C--D-- topic

What I want is a changelog with just B, C and D in it (i.e. no merge
commits and no commits already in upstream). I know if I wanted A,B,C
and D I could just do 'git log --no-merges upstream..topic'. If I do
'git log --no-merges B..topic' I get the merged commits from upstream.
In set-speak what I think want is the union of upstream..topic and
B..topic.

Is there any existing way to achieve this? I'm happy to hack something
up using git rev-list if necessary.

Thanks,
Chris

```

## Jeff King, 2011-07-18 00:17

Subject: Re: Getting a list of commits between 2 points without upstream changes
Message-ID: <20110718001749.GA706@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110718001749.GA706%40sigill.intra.peff.net
In-Reply-To: <CAFOYHZC5hQ9JV8a5d20AaPR_eYFDViama+4148MPumvvJ-n6wQ@mail.gmail.com>

```
On Mon, Jul 18, 2011 at 11:49:57AM +1200, Chris Packham wrote:

> I'm trying to send round an incremental changelog for my project which
> contains just my changes without changes that have been made upstream.
> The history look something like this.
> 
> ---o--o--o--o--o--o--o--o-- upstream
>     \          \        \
>      \-m--A--m--B--m--C--D-- topic
> 
> What I want is a changelog with just B, C and D in it (i.e. no merge
> commits and no commits already in upstream). I know if I wanted A,B,C
> and D I could just do 'git log --no-merges upstream..topic'. If I do
> 'git log --no-merges B..topic' I get the merged commits from upstream.
> In set-speak what I think want is the union of upstream..topic and
> B..topic.

I'm not clear on what makes "B" more special than "A" in the graph
above. But assuming you know A, don't you just want:

  git log --no-merges topic ^upstream ^A

? That is, "everything in topic, but not in upstream, nor in the parent
of A". Or if you know A and not B, you can use "^B^!" (which means "do
not include commits that are in any parent of B").

-Peff

```

## Chris Packham, 2011-07-18 00:33

Subject: Re: Getting a list of commits between 2 points without upstream changes
Message-ID: <CAFOYHZDUyQpVc5m4w9jcDsmed+UR8a_zxzR0mBAjPf7_A80MQg@mail.gmail.com>
URL: https://gitlist.dev/e/CAFOYHZDUyQpVc5m4w9jcDsmed%2BUR8a_zxzR0mBAjPf7_A80MQg%40mail.gmail.com
In-Reply-To: <20110718001749.GA706@sigill.intra.peff.net>

```
On Mon, Jul 18, 2011 at 12:17 PM, Jeff King <peff@peff.net> wrote:
> On Mon, Jul 18, 2011 at 11:49:57AM +1200, Chris Packham wrote:
>
>> I'm trying to send round an incremental changelog for my project which
>> contains just my changes without changes that have been made upstream.
>> The history look something like this.
>>
>> ---o--o--o--o--o--o--o--o-- upstream
>>     \          \        \
>>      \-m--A--m--B--m--C--D-- topic
>>
>> What I want is a changelog with just B, C and D in it (i.e. no merge
>> commits and no commits already in upstream). I know if I wanted A,B,C
>> and D I could just do 'git log --no-merges upstream..topic'. If I do
>> 'git log --no-merges B..topic' I get the merged commits from upstream.
>> In set-speak what I think want is the union of upstream..topic and
>> B..topic.
>
> I'm not clear on what makes "B" more special than "A" in the graph
> above. But assuming you know A, don't you just want:

What makes A special in this case is that commits up to and including
A have been reviewed, regression tested etc. My use-case is really
about telling people what has been worked on since the last time the
code was reviewed.

>
>  git log --no-merges topic ^upstream ^A
>
> ? That is, "everything in topic, but not in upstream, nor in the parent
> of A". Or if you know A and not B, you can use "^B^!" (which means "do
> not include commits that are in any parent of B").

Brilliant, that's exactly what I wanted. Thanks.

>
> -Peff
>

```

## Jeff King, 2011-07-18 01:28

Subject: Re: Getting a list of commits between 2 points without upstream changes
Message-ID: <20110718012844.GA2112@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110718012844.GA2112%40sigill.intra.peff.net
In-Reply-To: <CAFOYHZDUyQpVc5m4w9jcDsmed+UR8a_zxzR0mBAjPf7_A80MQg@mail.gmail.com>

```
On Mon, Jul 18, 2011 at 12:33:27PM +1200, Chris Packham wrote:

> > I'm not clear on what makes "B" more special than "A" in the graph
> > above. But assuming you know A, don't you just want:
> 
> What makes A special in this case is that commits up to and including
> A have been reviewed, regression tested etc. My use-case is really
> about telling people what has been worked on since the last time the
> code was reviewed.

OK, that makes sense.

> >  git log --no-merges topic ^upstream ^A
> >
> > ? That is, "everything in topic, but not in upstream, nor in the parent
> > of A". Or if you know A and not B, you can use "^B^!" (which means "do
> > not include commits that are in any parent of B").
> 
> Brilliant, that's exactly what I wanted. Thanks.

Oops, I mis-stated it above. It would be "everything in topic, but not
in upstream, nor in A". Which I think is what you actually want (I had
originally written it as "^B^!", but forgot to change the text when I
switched it to the more-readable "^A").

-Peff

```
