git使用与远程标签相同的名称推送本地分支 [英] git push local branch with same name as remote tag

查看:648
本文介绍了git使用与远程标签相同的名称推送本地分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将一个新的本地分支 product-0.2 推送到远程,其中已经有一个具有相同名称的标签(但分支本身不存在)

  git push -v --tags --set-upstream origin product-0.2:product-0.2 
推送到https://****@github.com/mycompany/product.git
错误:src refspec product-0.2匹配多个。
错误:无法将某些参考推送到'https://****@github.com/mycompany/product.git'

相同:

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

虽然其他方式可行,例如创建一个分支 product-0.1 ,在其上提交并应用一个标签 product-0.1



有些人通过在本地删除冲突标签来解决此问题,然后推送分支,然后检索远程标签,但看起来很麻烦并且容易出错。



感谢您的意见

$ b $ p

解决方案

下面的命令应该可以工作。

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


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'

Same with:

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.

Some people work around this by removing the conflicting tag locally, then push the branch, then retrieve the remote tag, but it seems cumbersome and error prone.

How can I create my branch with minimal fuss?

Thanks for your input

解决方案

The following command should work.

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

这篇关于git使用与远程标签相同的名称推送本地分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆