[英]Why git pull origin branchA:branchA can't work and pull origin branchA can work?
my git action is below: 我的git动作如下:
git pull origin mybranch1.3.3:mybranch1.3.3 ------> it rejected and tell me mo-fast-forwrd git pull origin mybranch1.3.3:mybranch1.3.3 ------>它拒绝了,告诉我mo-fast-forwrd
git pull origin mybranch1.3.3 --------> works well. git pull origin mybranch1.3.3 -------->效果很好。
and what's the difference? 有什么区别? isn't the last "mybranch1.3.3" means my local branch ?
最后一个“ mybranch1.3.3”不是我的本地分支吗?
springdeiMac:myApp qiushuitian$ git pull origin mybranch1.3.3:mybranch1.3.3
remote: Counting objects: 196, done.
remote: Compressing objects: 100% (94/94), done.
remote: Total 95 (delta 61), reused 0 (delta 0)
Unpacking objects: 100% (95/95), done.
From 192.168.1.39:myApp
! [rejected] mybranch1.3.3 -> mybranch1.3.3 (non-fast-forward)
a1a652f..3fd1572 mybranch1.3.3 -> origin/mybranch1.3.3
springdeiMac:myApp qiushuitian$ git pull origin mybranch1.3.3
From 192.168.1.39:myApp
* branch mybranch1.3.3 -> FETCH_HEAD
this is git pull syntax 这是git pull语法
git pull [<options>] [<repository> [<refspec…>]]
where options
, repository
and refspec
are optional parameters, but you must supply them to git command, as it is recommended otherwise the default behavior would be as mentioned by GIT Ducumentation 其中
options
, repository
和refspec
是可选参数,但是必须将它们提供给git命令,因为建议这样做,否则默认行为将如GIT Ducumentation所述
Often people use git pull without giving any parameter.
人们通常在不提供任何参数的情况下使用git pull。 Traditionally, this has been equivalent to saying
git pull origin
传统上,这相当于说
git pull origin
in the first command you have used Refspec , 在您使用Refspec的第一个命令中,
so in git pull origin mybranch1.3.3:mybranch1.3.3
the LHS of : is your <src>
and RHS to : is your <dst>
. 所以在
git pull origin mybranch1.3.3:mybranch1.3.3
的LHS:是你的<src>
和RHS到:是你的<dst>
and to ignore this error you can use +
in your Refspec 并忽略此错误,您可以在Refspec中使用
+
As Git says 正如吉特所说
The format of the refspec is an
optional +
, followed by<src>:<dst>
, where<src>
is the pattern for references on the remote side and<dst>
is where those references will be written locally.refspec的格式是
optional +
,后跟<src>:<dst>
,其中<src>
是远程引用的模式,而<dst>
是将这些引用本地写入的位置。 The+
tells Git to update the reference even if it isn't a fast-forward.+
告诉Git更新参考,即使参考不是快速转发。
And yes in the second command mybranch1.3.3
is your local branch. 是的,在第二个命令
mybranch1.3.3
是您的本地分支。 This command means to fetch the data from your origin
and merge
it to your local mybranch1.3.3
此命令意味着从
origin
获取数据merge
其merge
到本地mybranch1.3.3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.