# Shorthand for "$(git merge-base A B)"

3 messages from 2019-03-15 to 2019-03-18. Participants: John Passaro, Jonathan Nieder, Junio C Hamano.
Thread: https://gitlist.dev/t/50751

## John Passaro, 2019-03-15 18:58

Subject: Shorthand for "$(git merge-base A B)"
Message-ID: <CAJdN7KiS+6y0a3sj0yuGuJ+URJe0SBJJTRg2ZpA2upN2rwZXCA@mail.gmail.com>
URL: https://gitlist.dev/e/CAJdN7KiS%2B6y0a3sj0yuGuJ%2BURJe0SBJJTRg2ZpA2upN2rwZXCA%40mail.gmail.com

```
I find myself fairly frequently doing something like "git log $(git
merge-base A B)..C". As far as I can tell, there is no shorthand for
the $() part of this, but it seems like something that could be pretty
naturally added, or documented better if there is some esoteric
combination of the existing shorthands that would support it.

Is there any way to support a shorthand for $(git merge-base A B)? I
hoped a joiner in the spirit of A..B could be used:

A::B
A*B
A%B
If not, maybe A@{mb:B} or something along those lines?

I can imagine this would be a non-trivial amount of work, just
wondering if there is interest, or if anybody has thoughts on the
notation?

Thanks,
John

```

## Jonathan Nieder, 2019-03-15 21:23

Subject: Re: Shorthand for "$(git merge-base A B)"
Message-ID: <20190315212312.GA51592@google.com>
URL: https://gitlist.dev/e/20190315212312.GA51592%40google.com
In-Reply-To: <CAJdN7KiS+6y0a3sj0yuGuJ+URJe0SBJJTRg2ZpA2upN2rwZXCA@mail.gmail.com>

```
Hi,

John Passaro wrote:

> I find myself fairly frequently doing something like "git log $(git
> merge-base A B)..C".

Hm.  Can you tell me more about the workflow / higher-level operation
where you do this?

Curious,
Jonathan

```

## Junio C Hamano, 2019-03-18 05:27

Subject: Re: Shorthand for "$(git merge-base A B)"
Message-ID: <xmqqva0g4uri.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqva0g4uri.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <20190315212312.GA51592@google.com>

```
Jonathan Nieder <jrnieder@gmail.com> writes:

> John Passaro wrote:
>
>> I find myself fairly frequently doing something like "git log $(git
>> merge-base A B)..C".
>
> Hm.  Can you tell me more about the workflow / higher-level operation
> where you do this?

Yes indeed, that would be interesting to learn.  I can think of
reasons why "git log ^A ^B C" may be useful, but I do not think of a
case in which "git log --not $(git merge-base A B) --not C" [*1*]
would become useful.

[Footnote]

*1* As there can be more than one merge-base between A and B, the
 right way to write what John wanted to write is to do the above.
 A single "--not" says "until you see another --not, take all the
 positive one from the command line as negative and vice versa".
 You can also write it as "git log C --not $(git merge-base A B)".


```
