轻量级标签可以转换为注释标签吗? [英] Can a lightweight tag be converted to an annotated tag?

查看:132
本文介绍了轻量级标签可以转换为注释标签吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用一个轻量级标记标记了一个提交,并将该标记推送到远程回购,与其他开发人员共享。我现在已经意识到我应该注释它,使它出现在 git describe 中。

I've tagged a commit with a lightweight tag, and pushed that tag to a remote repo, shared with other developers. I have now realised I should have annotated it so that it appears in git describe.

有没有办法转换它/重标记的提交没有破坏的事情?

Is there a way to convert it/re-tag the commit without breaking things?

推荐答案

轻量级标记只是一个'ref'指向那承诺。您可以在旧标签的顶部强制创建一个新的带注释的标签:

A lightweight tag is just a 'ref' that points at that commit. You can force-create a new annotated tag on top of the old tag:

git tag -a -f <tagname> <tagname>

从Git v1.8.2开始,您需要使用 - force git push 替换远程的任何标签,即使你用一些有效快速转发或真实的东西替换了一个轻量级标签标记对象指向与现有标记引用相同的提交。

As of Git v1.8.2, you need to use --force to replace any tags on a remote with git push, even if you are replacing a lightweight tag with something that is effectively a fast-forward or a true tag object pointing at the same commit as the existing tag reference.

git push --force origin <tagname>

这篇关于轻量级标签可以转换为注释标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆