2017-08-29 114 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

相關問題