2017-08-29 93 views
-4

我只是想能写:如何设置`git pull`来做`git pull origin master`呢?

$ git pull 
// does the same as $ git pull origin master 
$ git push 
// does the same as $ git push origin master 

除了目前当我做$ git pull我得到:

There is no tracking information for the current branch. 
Please specify which branch you want to merge with. 
See git-pull(1) for details. 

    git pull <remote> <branch> 

If you wish to set tracking information for this branch you can do so with: 

    git branch --set-upstream-to=origin/<branch> master 
+3

的[使现有的Git分支轨迹可能的复制一个远程分支?](https://stackoverflow.com/questions/520650/make-an-existing-git-branch-track-a-remote-branch) –

+1

答案在问题中。 – axiac

+0

请考虑花15秒钟实际读取您粘贴到您的问题中的'git pull'的输出。 Git命令可能会产生令人困惑的输出,但我认为这是一个非常明确反馈的例子。 – Chris

回答

2

它是这么说的右边有错误消息:

git branch --set-upstream-to=origin/master master 

当然,假设您在本地也在分支master

设置上游的含义是什么?

检出从远程跟踪分支 一个本地分支自动创建所谓的“追踪分支”(以及 分支它跟踪被称为“上游分支”)。跟踪分支 是与远程分支有直接关系的本地分支。 如果你在一个跟踪分支里输入git拉,Git会自动 知道从获取其服务器和分支合并到

来源:the Git book

+0

你能解释一下'upstream'是什么吗? – 14wml

+2

我会把它留给[Git书](https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches)。 – Thomas

+0

“git branch --set-upstream-to = origin/master master”的意思是什么? – 14wml

相关问题