git git标签删除并重新添加
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7947078/
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
git tag delete and re-add
提问by Chris Muench
On git hub I re-added the tag by doing:
在 git hub 上,我通过执行以下操作重新添加了标签:
git tag -d 12.15
git push origin :refs/tags/12.15
git tag -a 12.15 -m '12.15'
git push --tags
The tag is still referring to the old tag on github, but locally it is done right.
标签仍然是指github上的旧标签,但在本地做对了。
UPDATE: It seems github is listing the last commit wrong, but downloading it correctly.
更新:似乎 github 列出了最后一次提交错误,但下载正确。
回答by nickleefly
The reference is https://stackoverflow.com/a/5480292/1317035
参考是https://stackoverflow.com/a/5480292/1317035
You just need to push an 'empty' reference to the remote tag name:
您只需要推送一个对远程标签名称的“空”引用:
git push origin :tagname
Or, more expressively, use the --delete
option:
或者,更形象地,使用--delete
选项:
git push --delete origin tagname
Pushing a branch, tag, or other ref to a remote repository involves specifying "push where, what source, what destination?"
将分支、标签或其他引用推送到远程存储库涉及指定“推送位置、来源、目的地?”
git push where-to-push source-ref:destination-ref
A real world example where you push your master branch to the origin's master branch is:
将主分支推送到源的主分支的真实示例是:
git push origin refs/heads/master:refs/heads/master
Which because of default paths, can be shortened to:
由于默认路径,可以缩短为:
git push origin master:master
Tags work the same way:
标签的工作方式相同:
git push refs/tags/release-1.0:refs/tags/release-1.0
By omitting the source ref (the part before the colon), you push 'nothing' to the destination, deleting the ref on the remote end.
通过省略源引用(冒号之前的部分),您将“无”推送到目标,删除远程端的引用。