# Advanced revision selection?

2 messages from 2016-05-27 to 2016-05-27. Participants: Nikolaus Rath, Matthieu Moy.
Thread: https://gitlist.dev/t/42469

## Nikolaus Rath, 2016-05-27 15:39

Subject: Advanced revision selection?
Message-ID: <874m9j7bnv.fsf@thinkpad.rath.org>
URL: https://gitlist.dev/e/874m9j7bnv.fsf%40thinkpad.rath.org

```
Hello,

Is there a way to specify revision ranges that has more power than
what's described in gitrevisions(7)?

For example, is there a way to show "the three most recent commits
preceding a tag that starts with "release-" that are also descendants of
commit aebecf."?

In Mercurial, this can be done with a more verbose syntax (e.g.
"last(ancestors(tag("re:release-.*")),3) and descendants(aebeccf)" for
the above example). Is there no equivalent in Git, or am I looking for
it in the wrong place?

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«

```

## Matthieu Moy, 2016-05-27 15:59

Subject: Re: Advanced revision selection?
Message-ID: <vpq8tyvmqzz.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpq8tyvmqzz.fsf%40anie.imag.fr
In-Reply-To: <874m9j7bnv.fsf@thinkpad.rath.org>

```
Nikolaus Rath <Nikolaus@rath.org> writes:

> In Mercurial, this can be done with a more verbose syntax (e.g.
> "last(ancestors(tag("re:release-.*")),3) and descendants(aebeccf)" for
> the above example).

This has no direct equivalent in Git. A lot can be done passing options
to "git rev-list" or so, for example, but I don't think a combination
can be found for your exact example.

The closest I get is:

  git log `git for-each-ref refs/tags/release- --format '%(refname)'` -3

Which lists 3 commits preceeding a tag whose name starts with release-.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```
