From: Junio C Hamano <gitster@pobox.com>
To: M Hickford <mirth.hickford@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: How to exclude tagged commits from git log <revision-range>?
Date: Wed, 25 Jun 2025 13:47:27 -0700 [thread overview]
Message-ID: <xmqqikkjtuow.fsf@gitster.g> (raw)
In-Reply-To: <CAGJzqskFuQqLHgFk97S9uaBB=iW2Ni=NWokHJzMV5rYGsCOG4g@mail.gmail.com> (M. Hickford's message of "Wed, 25 Jun 2025 21:30:00 +0100")
M Hickford <mirth.hickford@gmail.com> writes:
> Hi. Is it possible to exclude tagged commits from a revision range?
A so called "revision range" is a set of commits that are defined by
reachability from two sets of commits, one "positive set" and one
"negative set". A commit is in the "revision range" if and only if
it is reachable from one or more commits in the positive set but it
is not reachable from any commit in the negative set.
> I tried
>
> git log --exclude=ref/tags/v* v2.3.0..v2.4.0
"--exclude" only affects the selection of "positive set" commits via
globbing operators like "--all". When you say "git log --all", the
tips of all refs are thrown into the "positive set", but with the
--exclude=<glob>, the refs that match <glob> pattern are not thrown
into the "positive set". As you have no "--all" or "--glob", it has
no effect. Your "positive set" consists of the commit tagged as
v2.4.0 and your "negative set" has the commit tagged as v2.3.0.
As "revision range" is a set operation (i.e. compute "the set of
all commits that are reachable from any commits in the negative set",
and "the set of all commits that are reachable from any commits in
the positive set", and subtract the former from the latter), skipping
arbitrary commit in the middle, like this one wants to do:
> git log --oneline --decorate v2.3.0..v2.4.0 | grep --invert-match "tag: v"
would generally be impossible to do. If you want to omit, say,
v2.3.5, that is reachable from v2.4.0, and can reach v2.3.0, but
cannot be reached from v2.3.0, "excluding" it by throwing it into
the "negative set" would also omit anything reachable from it.
next prev parent reply other threads:[~2025-06-25 20:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 20:30 How to exclude tagged commits from git log <revision-range>? M Hickford
2025-06-25 20:47 ` Junio C Hamano [this message]
2025-06-25 21:26 ` Jacob Keller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqikkjtuow.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mirth.hickford@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox