git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Proposal for pruning tags

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 5, 2014, 20:50 UTC
Message-ID
<xmqqoay7rsgd.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAHd499BLX3q2FHLfFpq_14w2mmosywfRqMHVjkke0BRhAAjx7g@mail.gmail.com>
Robert Dailey <rcdailey.lists@gmail.com> writes:
Show 9 quoted lines
> I've never contributed to the Git project before. I'm a Windows user,
> so I use msysgit, but I'd be happy to install linux just so I can help
> implement this feature if everyone feels it would be useful.
>
> Right now AFAIK, there is no way to prune tags through Git. The way I
> currently do it is like so:
>
> $ git tag -l | xargs git tag -d
> $ git fetch --all

I think you need to explain what you mean by "prune" a lot better than what you are doing in your message to be understood by others.

After seeing the above two commands, my *guess* of what you want to do is to remove any of your local tag that is *not* present in the repository you usually fetch from (aka "origin"), but that directly contradicts with what you said you wish, i.e.

> This is not only wasteful, but dangerous. I might accidentally delete
> a local tag I haven't pushed yet...

which only shows that your definition of "prune" is different from "remove what I do not have at 'origin'".

But it does not say *how* that is different. How should "prune" behave differently from the two commands above? How does your "prune" decide a tag needs to be removed locally when it is not at your "origin" [*1*]?

There is *nothing* in git that lets you look at a local tag that is missing from the other side and determine if that is something you did not want to push (hence it is missing there) of if that is something you forgot to push (hence it is missing there but you would rather have pushed if you did not forget). So you must have some new mechanism to record and/or infer that distinction in mind, but it is not clear what it is from your message.

So until that is clarified, there is not much more to say if your "feature" has any merit---as there is no way to tell what that "feature" exactly is, at least not yet ;-)

[Footnote]
*1* By the way, removing and then refetching would be a silly way to
    do this kind of thing anyway.  After removing but before you
    have a chance to fetch, your ISP may severe your network
    connection and then what happens?
    Whatever your definition of "prune" is, I would think it would
    be built around "ls-remote --tags" output, to see what tags the
    other repository (or other repositories, by looping over the
    remotes you interact with) have, compare that set with the tags
    you locally have in order to decide which subset of tags you
    locally have to remove.
Previous: Robert DaileyNext: Robert Dailey
Message 2 of 5 in “Proposal for pruning tags”
  1. Robert DaileyJun 5, 2014
  2. Junio C HamanoJun 5, 2014
  3. Robert DaileyJun 6, 2014
  4. Junio C HamanoJun 6, 2014
  5. Michael HaggertyJun 11, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.