英文:
GIT returning fatal "[tag] already exists" error when Deleting then Recreating Tags
问题
在GIT中,我正在尝试执行一系列的GIT命令来删除一个已存在的标签,然后重新创建它。然而,它返回一个“致命错误:标签'2.0.1'已经存在”的错误。有没有人知道我做错了什么,或者可能漏掉了哪个命令?
我正在执行以下一系列的命令:
git clone git@git.someaddress.com/test_project project_dir
cd project_dir
git push --delete origin 2.0.1
git tag 2.0.1 -m "重新创建标签"
目前为了解决这个问题,在执行push --delete
命令之后,我删除了project_dir
,然后重新克隆存储库以创建标签,这并不是非常高效的方法。
英文:
In GIT, I am trying to execute a series of GIT commands to delete an existing tag then recreate it. However, it is returning a "fatal: tag '2.0.1' already exists" error. Anyone have any idea what I'm doing wrong or what command I'm possibly missing?
I am executing the following sequence of commands:
git clone git@git.someaddress.com/test_project project_dir
cd project_dir
git push --delete origin 2.0.1
git tag 2.0.1 -m "Recreated tag"
Currently to work around this, after I execute the push --delete command, I'm deleting project_dir and recloning the repo to create the tag, which isn't very efficient.
答案1
得分: 2
你还需要删除本地副本的标签:
git tag -d 2.0.1
从远程删除不会删除本地仓库中的标签。
英文:
You also have to delete your local copy of the tag:
git tag -d 2.0.1
Deleting it from the remote does not delete it from your local repository.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论