我试图将一个名为
product-0.2
的本地分支推送到远程仓库,但是已经有一个同名的标签(但该分支本身不存在)。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
虽然倒过来操作是可行的,例如创建一个分支 product-0.1
,提交并应用标签 product-0.1
,但有些人会通过在本地删除冲突的标签,然后推送分支,再获取远程标签的方式来解决此问题,但这似乎很麻烦且容易出错。
有什么方法可以轻松创建我的分支吗?
感谢您的建议。
refs/heads/product-0.2:refs/heads/product-0.2
,即不带前导斜杠,并在本地端提供完整的refspec。 - knittl