2014-10-17 56 views
0

我在使用Git設置看似簡單的工作流時遇到了問題。簡單的Git工作流程

說我有兩個開發人員,DevA和DevB。有一個名爲'origin'的開發人員可以訪問的遠程倉庫。

德瓦創建從 '主' 的一個分支...

git checkout -b 'newbranch' 

德瓦進行更改newbranch並提交

git add . 
git commit -m 'newbranch changes' 

德瓦推動改變原產

git push --all 

發展局想要分支機構

git fetch --all 

發展局希望在newbranch工作

git checkout newbranch 
git pull newbranch 

發展局進行了更改newbranch並將更改原產

git add . 
git commit -m 'message' 
git push --all 

德瓦需要從遠程的變化,並得到...

git checkout newbranch 
git pull --all 

You asked to pull from the remote '--all', but did not specify 
a branch. Because this is not the default configured remote 
for your current branch, you must specify a branch on the command line. 

然後...

git branch -r 

origin/newbranch 
origin/HEAD -> origin/master 
origin/master 

然後...

git pull origin/newbranch 

fatal: 'origin/newbranch' does not appear to be a git repository 
fatal: Could not read from remote repository. 

有人能告訴我這裏有什麼問題?

+1

好像正確的工作流程。你得到什麼錯誤? – 2014-10-17 20:30:07

+0

我澄清了包括一些錯誤的問題。 – 2014-10-17 20:43:19

+2

不要使用'git pull --all',只需使用'git pull',並注意它只能從追蹤分支中運行。你可以看到'git branch -vv'的跟蹤信息。 – 2014-10-17 20:44:17

回答

2

嘗試git push --all origingit pull --all origin

1

我在這裏可能是錯的,但我認爲當您使用git pull --all時,它認爲--all是您的遠程存儲庫的名稱。我想DevA只需要做:git pull origin newbranch

另一種選擇是使用git fetch origin,然後DevA可以使用git merge origin/newbranch手動進行合併。