{"thread":{"id":"63695","subject":"How to exclude tagged commits from git log <revision-range>?","startedAt":"2025-06-25T20:31:27Z","lastAt":"2025-06-25T21:26:53Z","messageCount":3,"participants":["M Hickford","Junio C Hamano","Jacob Keller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"520730","messageId":"CAGJzqskFuQqLHgFk97S9uaBB=iW2Ni=NWokHJzMV5rYGsCOG4g@mail.gmail.com","threadId":"63695","inReplyTo":null,"subject":"How to exclude tagged commits from git log <revision-range>?","fromName":"M Hickford","fromEmail":"mirth.hickford@gmail.com","sentAt":"2025-06-25T20:30:00Z","receivedAt":"2025-06-25T20:31:27Z","isPatch":false,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"Hi. Is it possible to exclude tagged commits from a revision range?\n\nI tried\n\n     git log --exclude=ref/tags/v* v2.3.0..v2.4.0\n\nbut this didn't exclude any commits.\n\nAn inelegant workaround is:\n\n     git log --oneline --decorate v2.3.0..v2.4.0 | grep --invert-match \"tag: v\"\n"},{"id":"520731","messageId":"xmqqikkjtuow.fsf@gitster.g","threadId":"63695","inReplyTo":"CAGJzqskFuQqLHgFk97S9uaBB=iW2Ni=NWokHJzMV5rYGsCOG4g@mail.gmail.com","subject":"Re: How to exclude tagged commits from git log <revision-range>?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-06-25T20:47:27Z","receivedAt":"2025-06-25T20:47:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"M Hickford <mirth.hickford@gmail.com> writes:\n\n> Hi. Is it possible to exclude tagged commits from a revision range?\n\nA so called \"revision range\" is a set of commits that are defined by\nreachability from two sets of commits, one \"positive set\" and one\n\"negative set\".  A commit is in the \"revision range\" if and only if\nit is reachable from one or more commits in the positive set but it\nis not reachable from any commit in the negative set.\n\n> I tried\n>\n>      git log --exclude=ref/tags/v* v2.3.0..v2.4.0\n\n\"--exclude\" only affects the selection of \"positive set\" commits via\nglobbing operators like \"--all\".  When you say \"git log --all\", the\ntips of all refs are thrown into the \"positive set\", but with the\n--exclude=<glob>, the refs that match <glob> pattern are not thrown\ninto the \"positive set\".  As you have no \"--all\" or \"--glob\", it has\nno effect.  Your \"positive set\" consists of the commit tagged as\nv2.4.0 and your \"negative set\" has the commit tagged as v2.3.0.\n\nAs \"revision range\" is a set operation (i.e. compute \"the set of\nall commits that are reachable from any commits in the negative set\",\nand \"the set of all commits that are reachable from any commits in\nthe positive set\", and subtract the former from the latter), skipping\narbitrary commit in the middle, like this one wants to do:\n\n>      git log --oneline --decorate v2.3.0..v2.4.0 | grep --invert-match \"tag: v\"\n\nwould generally be impossible to do.  If you want to omit, say,\nv2.3.5, that is reachable from v2.4.0, and can reach v2.3.0, but\ncannot be reached from v2.3.0, \"excluding\" it by throwing it into\nthe \"negative set\" would also omit anything reachable from it.\n\n"},{"id":"520732","messageId":"0595f247-745f-4d57-9d20-4c2065b6c902@intel.com","threadId":"63695","inReplyTo":"CAGJzqskFuQqLHgFk97S9uaBB=iW2Ni=NWokHJzMV5rYGsCOG4g@mail.gmail.com","subject":"Re: How to exclude tagged commits from git log <revision-range>?","fromName":"Jacob Keller","fromEmail":"jacob.e.keller@intel.com","sentAt":"2025-06-25T21:26:50Z","receivedAt":"2025-06-25T21:26:53Z","isPatch":false,"sender":{"key":"jacob.e.keller@intel.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"\n\nOn 6/25/2025 1:30 PM, M Hickford wrote:\n> Hi. Is it possible to exclude tagged commits from a revision range?\n> \n> I tried\n> \n>      git log --exclude=ref/tags/v* v2.3.0..v2.4.0\n> \n> but this didn't exclude any commits.\n> \n> An inelegant workaround is:\n> \n>      git log --oneline --decorate v2.3.0..v2.4.0 | grep --invert-match \"tag: v\"\n> \n\nWhat is your actual end goal with this git log? Why do you want to not\nsee tag commits?\n\nI think your \"inelegant\" solution may be the only way to get what you want.\n"}]}