On Thu, Dec 15, 2022 at 02:08:22PM -0800, Graham Menhennitt wrote: [...] >> Note that the branches are irrelevant for traversing. You can use branches >> to refer to commits, but any way to refer to them would do; the traversal >> process itself is only concerned with commits. [...] > Unfortunately, that doesn't quite match my requirements - as you say above, > it doesn't filter by branches. So the list of tags produced by your command > includes ones that do not belong to branch X. I'll try to filter it somehow.
While it appears the snippet I have come up with actually helped, it would reiterate that tags in Git are never "on" any branch. You can attach tags to any "objects" stored in a Git repository: to blobs (a blob is the data of a particular version of a particular data), trees (they keep names of the blobs serving as directories on filesystems), and commits. Branches are somewhat immaterial in this regard: when you do git tag mytag master you do not attach a tag "mytag" to the branch "master" or to a commit on branch "master"; instead, Git takes than name "master", looks it up, figures out it's the name of a branch, _resolves_ it to its tip commit and finally attaches the tag "mytag" to that commit. You could then go on and remove the branch "master" completely, and that would do nothing to the tag. When you work with Git, it really helps to stop thinking much about branches and start thinking of a graph of commits which refer one another and symbilic references to some of these commits. These references are branches and tags. See, even a sort of obvious git log master does not tell Git to traverse commits on the master branch, it tells Git to start with the tip commit on the branch "master" and traverse the history reachable from that commit. Every commit in that subgraph may be reachable from any number of branches - not only "master" - and any number of tags. Reachable, bot not "belonging to" or "being on". That's actually a crucial concept to absorb to make reasoning about Git much easier. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/20221216111636.3wp76fybvsnidksf%40carbon.