如何删除所有 git origin 和 local 标签?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44702757/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:02:49  来源:igfitidea点击:

How to remove all git origin and local tags?

gittagsremoveall

提问by Amir Hosseinzadeh

How do you remove a git tag that has already been pushed? Delete all git remote (origin) tags and Delete all git local tags.

如何删除已经推送的 git 标签?删除所有 git remote (origin) 标签和删除所有 git local 标签。

回答by Amir Hosseinzadeh

1. Delete All local tags. (Optional Recommended)

1. 删除所有本地标签。(可选推荐)

git tag -d $(git tag -l)

2. Fetch remote All tags. (Optional Recommended)

2. 获取远程所有标签。(可选推荐)

git fetch

3. Delete All remote tags.

3. 删除所有远程标签。

git push origin --delete $(git tag -l) # Pushing once should be faster than multiple times

4. Delete All local tags.

4. 删除所有本地标签。

git tag -d $(git tag -l)

回答by npocmaka

For windows using command prompt:

对于使用命令提示符的 Windows:

Deleting local tags:

删除本地标签:

for /f "tokens=* delims=" %a in ('git tag -l') do git tag -d %a

Deleting remote tags:

删除远程标签:

for /f "tokens=* delims=" %a in ('git tag -l') do git push --delete origin %a