git tag -l不会删除已删除的标签 [英] git tag -l does not remove deleted tags
问题描述
这是场景
我将存储库克隆到了一个我经常通过
I cloned my repository to a directory which I regularly update by
git pull
现在,我又创建了一个目录,并检出了相同的存储库
Now I created one more directory and checked out same repository
我必须创建一些标签,但是错误地创建了名称错误的标签所以我从第一个目录中删除了标签
I had to create some tags, but by mistake I created tags with wrong name so I deleted tags from the first directory
git tag -d old
git push origin :refs/tags/old
git push --tags
如果从第二个目录我正在尝试
If from second directory I am trying
git tag -l
我无法获取同步信息,因为标签没有从列表中删除
I am not able to get synchronised information as tag does not get deleted from list
然后我做了
git pull --tags
添加的标签会反映出来,但删除的标签不会被删除.
Added tags get reflected but deleted tags does not get deleted.
git pull origin --tags
结果不变
如何获取同步列表,以便删除的标签也反映在其他目录中.
How can I get synchronised list so that tags deleted are also reflected in other directory.
推荐答案
以下内容将删除不在远程计算机上的所有本地标签.
The following will delete any local tags that are not on the remote.
git fetch origin refs/tags/*:refs/tags/* --prune
为了自动获取标签,请将以下行添加到 .git/config
文件的 [remote"origin"]
条目下.
In order to fetch tags automatically, add the following line to your .git/config
file under the entry for [remote "origin"]
.
fetch = refs/tags/*:refs/tags/*
这篇关于git tag -l不会删除已删除的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!