Is there a way to keep my local git tags in lockstep with a remote's tags? That is -- not only get new tags when created (as usual, when
git push -f
git fetch remotename
git remote prune remotename
A bit of research has shown that git has no way to tell the difference between local or foreign tags (all tags go to .git/refs/tags/). Therefore, it is not possible to determine the difference between locally created tags and prune-able remote tags. The options, are then reduced to: having an ever growing set of tags, or only the tags that are on the server.
git push --tags origin && \ git tag | xargs -n1 git tag -d && \ git fetch --tags
Drop the first line for the latter behaviour, and could be potentially git alias'd for frequent usage.
An alternative would be to create a branch (as they can be identified as local/remote) at a tag point and are never write to it again. Then using remotename/branchname as a tag to checkout would keep tags in sync (in addition to
git fetch and
git remote prune remotename).
Either way is a hack, and the "right" answer is to stop changing tags all the time.