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

Re: Proposal for pruning tags

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jun 11, 2014, 09:25 UTC
Message-ID
<539820A4.6090708@alum.mit.edu>
In-Reply-To
<CAHd499BLX3q2FHLfFpq_14w2mmosywfRqMHVjkke0BRhAAjx7g@mail.gmail.com>
On 06/05/2014 04:51 PM, Robert Dailey wrote:
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

Junio explained some limitations of tags (namely that there is only one tags namespace that is shared project-wide) that makes your wish impossible to implement the way it works for branches.

Local tags are awkward for the same reason. It is too easy to push them accidentally to a central repository and too hard to delete them after that has happened. They kindof spread virally, as you have noticed. I recommend against using local tags in general.

Recent Git does have a feature that might help you. *If* you have a central repository that is "authoritative" WRT tags, then you can sync the tags in your local repository to the tags in the central repo using

    git fetch --prune $REMOTE +refs/tags/*:refs/tags/*

You might also be able to use a pre-receive hook on the central repo to prevent tags from being pushed by people who shouldn't be doing so, or to require that tags have an approved format (like refs/tags/release-\d+\.\d+\.\d+ or whatever) to try to prevent a recurrence of the problem.

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Junio C Hamano
Message 5 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.