我用一个轻量级标记标记了一个提交,并将该标记推送到远程回购,与其他开发人员共享。我现在已经意识到我应该注释它,使它出现在 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>更多推荐
轻量级标签可以转换为注释标签吗?
发布评论