can all tags be removed from the local repository?
It seems that I have the option to delete one by one, for example:
git tag tag_name --delete
or delete the ones that are not on the remote :
git fetch --prune --prune-tags
But regardless of the remote's labels? That is, if for example we did not have access to this
1. Remove all local tags. (Optional recommended)
2. Get all the labels from the remote. (Optional recommended)
git fetch
3. Delete all remote tags.
git push origin --delete $(git tag -l) # Pushing once should be faster than multiple times
You can get a list of remote tags via
git ls-remote
. To list the tags in the referenced repositoryorigin
, you need to run:git ls-remote --tags origin
That returns a list of hashes and friendly tag names, like:
Certainly you could put together a bash script to compare the tags generated by this list with the tags you have locally. Take a look at
git show-ref --tags
, which generates tag names in the same way asgit ls-remote
).As an aside,
git show-ref
an option that does the opposite of what you'd like. The following command would list all the tags on the remote branch that you don't have locally:git ls-remote --tags origin | git show-ref --tags --exclude-existing
Font: