git push与远程标签同名的本地分支

I'm trying to push a new local branch product-0.2 to remote where there is already a tag with the same name (but the branch itself does not exist)

git push -v --tags --set-upstream origin product-0.2:product-0.2 
Pushing to https://****@github.com/mycompany/product.git
error: src refspec product-0.2 matches more than one.
error: failed to push some refs to 'https://****@github.com/mycompany/product.git'

与:

git push origin product-0.2:/refs/heads/product-0.2 

Although the other way around it works, e.g. create a branch product-0.1, commit on it then apply a tag product-0.1.

有些人通过在本地删除有冲突的标签,然后推送分支,然后检索远程标签来解决此问题,但这似乎既麻烦又容易出错。

如何以最小的麻烦创建分支?

感谢您的输入

最佳答案

以下命令应该起作用。

git push origin refs/heads/product-0.2:refs/heads/product-0.2