public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* How to exclude tagged commits from git log <revision-range>?
@ 2025-06-25 20:30 M Hickford
  2025-06-25 20:47 ` Junio C Hamano
  2025-06-25 21:26 ` Jacob Keller
  0 siblings, 2 replies; 3+ messages in thread
From: M Hickford @ 2025-06-25 20:30 UTC (permalink / raw)
  To: Git Mailing List

Hi. Is it possible to exclude tagged commits from a revision range?

I tried

     git log --exclude=ref/tags/v* v2.3.0..v2.4.0

but this didn't exclude any commits.

An inelegant workaround is:

     git log --oneline --decorate v2.3.0..v2.4.0 | grep --invert-match "tag: v"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to exclude tagged commits from git log <revision-range>?
  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
  2025-06-25 21:26 ` Jacob Keller
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2025-06-25 20:47 UTC (permalink / raw)
  To: M Hickford; +Cc: Git Mailing List

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to exclude tagged commits from git log <revision-range>?
  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
@ 2025-06-25 21:26 ` Jacob Keller
  1 sibling, 0 replies; 3+ messages in thread
From: Jacob Keller @ 2025-06-25 21:26 UTC (permalink / raw)
  To: M Hickford, Git Mailing List



On 6/25/2025 1:30 PM, M Hickford wrote:
> Hi. Is it possible to exclude tagged commits from a revision range?
> 
> I tried
> 
>      git log --exclude=ref/tags/v* v2.3.0..v2.4.0
> 
> but this didn't exclude any commits.
> 
> An inelegant workaround is:
> 
>      git log --oneline --decorate v2.3.0..v2.4.0 | grep --invert-match "tag: v"
> 

What is your actual end goal with this git log? Why do you want to not
see tag commits?

I think your "inelegant" solution may be the only way to get what you want.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-25 21:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2025-06-25 21:26 ` Jacob Keller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox