Subject: Re: Proposal for pruning tags

From: Michael Haggerty <[email-masked]>
Date: Wed, 11 Jun 2014 11:25:56 +0200

On 06/05/2014 04:51 PM, Robert Dailey wrote:
> 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
[email-masked]
http://softwareswirl.blogspot.com/