将git标记"1.0“重命名为"1.5”后
git tag 1.5 1.0
git tag -d 1.0
git push origin :refs/tags/1.0
我的git存储库似乎处于不一致的状态。以下是git describe
的输出:
warning: tag '1.0' is really '1.5' here
1.0-97-g88085b2
它现在应该返回1.5-...
git fsck --tags
输出:
Checking object directories: 100% (256/256), done.
tagged commit aad9477bba4bcf44ea34ea9693aeffc98527ff01 (1.0) in b96ce67583239e198f9e2aff5175176d65779044
Checking objects: 100% (3975/3975), done.
如何删除对已删除标记的悬空引用?这是重命名标签的正确方式吗?
发布于 2013-01-17 22:55:03
每当有人建议重写历史(或者在这种情况下,重新标记历史)时,重申标准的警告--如果可以避免,就不要这么做。
然而,有些时候,不准确(混乱)的历史带来的长期痛苦是不值得的,短期的痛苦是值得的。
如果是这样的话,下面的文章给出了所需的步骤:How to Rename a Tag Already Pushed to a Remote git Repo。
基本步骤如下:
git tag new_tag old_tag
git push --tags
git push origin :refs/tags/old_tag
git tag -d old_tag
发布于 2019-03-12 05:56:37
我不确定这有多有用,但我在使用release-it时遇到了这个警告。在我的远程存储库中,有轻量级和带注释的标记条目对应于相同的标记名称:
$ git ls-remote --tags origin
302883ef0cb2df8975abfbd24bbe89f64cf3da31 refs/tags/0.0.1
4852192308b404d74d7a4088c19a4629299f6ea2 refs/tags/0.0.1^{}
(请注意第二个条目上标记名称后的^{}
)
这对于带注释的标签(?)来说似乎是正常的,所以不要认为这就是问题本身,但在我删除了所有的标签并重新标记了所有内容之后,问题就消失了。例如,对于上面的标记...
git tag -d 0.0.1 # Delete local tag
git push --delete origin 0.0.1 # Delete remote tag
git tag -a -m "" 0.0.1 4852192308b404d74d7a4088c19a4629299f6ea2 # Recreate [annotated] tag
git push --tags # Push tag(s) to remote repo
https://stackoverflow.com/questions/14380053
复制相似问题