Git force push tag when the tag already exists on remote

ε祈祈猫儿з 提交于 2019-12-03 09:31:04

In my case, remote was rejecting an force push when the tag already exists.

So, when the push was rejected, I did

git push --delete origin tagname 

and pushed the new tag.

Please see Torek's comment to my question. There is a case when remote can reject the delete too.

This will force push all the tags and overwrite the existing ones.

git push -f --tags

Firstly, delete all the tags in remote:

git tag -l | awk 'BEGIN{ORS=" "}{print $0}' | xargs git push origin --delete

then push all tags to remote:

git push --tags
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!