简体   繁体   English

为什么git pull origin branchA不能工作,而pull origin branchA可以工作?

[英]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 其中optionsrepositoryrefspec是可选参数,但是必须将它们提供给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.3LHS:是你的<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获取数据mergemerge到本地mybranch1.3.3

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当通过 git checkout BranchA 连接到 BranchA 时,如果我执行 git pull BranchB 那么 BranchB 代码是否会被拉入 BranchA? - When connected to BranchA via git checkout BranchA, if I do git pull BranchB then will BranchB code get pulled into BranchA? 我不小心运行了`git branch<brancha><branchb> -f` 并且不能 go 回到之前的 state</branchb></brancha> - I accidentally run `git branch <branchA> <branchB> -f` and can't go back to previous state 为什么 git pull origin master 不起作用,但 git pull 可以? - Why did a git pull origin master not work, but a git pull did? Git-分支BranchA时,如何重置新的分支BranchB,使其不包含任何BranchA内容? - Git - When branching off BranchA, how do I reset my new branch BranchB so it doesn't have any BranchA content? git 命令在没有合并的情况下用 branchA 覆盖 branchC - git command to override branchC with branchA without merge &#39;git log branchA branchB&#39;是做什么的? - What does 'git log branchA branchB' do? 我从创建 branchA 的地方有一个 branchZ,从那个 branchA 我创建了一个 branchB,我可以让 branchB 来自 branchZ 吗? - I have a branchZ from where I created a branchA and from that branchA I created a branchB, can I make it so branchB comes from branchZ? 由于文件已删除,Git无法从原点拉出 - Git can't pull from origin because of deleted file 如何将 branchA 的 branchB 合并到 Git 中的 Master 中? - How do I merge my branchB of branchA into Master in Git? 使用 Git,找到可从 branchA 和 branchB 访问的提交 - Using Git, find commit that is reachable from both branchA and branchB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM