2013-01-08 91 views
2

我懷疑我所遵循的工作流是否正確,或者我弄糟了這種情況。Git分支轉移問題和工作流程

我正在研究本地和遠程創建的分支上的新功能。我是唯一從事這項工作的人。

我創建它使用:

git checkout -b rotation upstream/master 

現在我所做的更改和COMMITED:

git commit 

和變化被推到遠程分支:現在

git push origin rotation 

我的問題開始。此時我輸入了git fetch upstream

現在,當我git status我得到的,

[email protected]:~/QgisGitWorking/Quantum-GIS$ git status 
# On branch rotatation 
# Your branch and 'upstream/master' have diverged, 
# and have 4 and 5 different commits each, respectively. 
# 
nothing to commit (working directory clean) 

我很困惑由分支分歧的消息。

  1. 這裏有什麼不對嗎?
  2. 如果我繼續 在這裏提交更改並推送上游,是否會出現問題?
  3. 如果有什麼錯,改正它的最好方法是什麼?

我對git相當陌生。以前我只用過VSS。

編輯:

[email protected]:~/QgisGitWorking/Quantum-GIS$ git remote -v 
origin [email protected]:vinayan/Quantum-GIS.git (fetch) 
origin [email protected]:vinayan/Quantum-GIS.git (push) 
upstream git://github.com/qgis/Quantum-GIS.git (fetch) 
upstream git://github.com/qgis/Quantum-GIS.git (push) 
+0

你從'git branch -avv'得到了什麼? – ellotheth

+0

@ellotheth - 我得到http://pastebin.com/ncAB56Y3 – vinayan

回答

1

upstream的想法是爲了讓自己的回購協議本身upstream回購變基上的最新頂部。
通過這種方式,您可以與上游保持同步,同時將自己的貢獻推向'origin'(這是一個分支:您擁有的upstream回購的克隆)。

您可以推送到origin。你不能推到upstream(你是不是貢獻者)
請參閱「What is the difference between origin and upstream in GitHub?

upstream

在你的情況,我建議,因爲upstream/master都有自己的歷史(平行於更改)

git checkout rotation 
git rebase upstream/master 
git push -f origin rotation 

需要注意的是力推(即重建的更改歷史)上的叉origin/rotation:如果沒有其他的貢獻已經從你的叉子拉,這不應該是一個問題。
而你在rotation上的工作將基於最新的upstream/master,這將簡化你可能想要做的future pull request

+0

@jthill正確。回答編輯。 – VonC

1

你推rotationorigin,但你從upstream牽強。這是兩種不同的遙控器,因此具有不同歷史的兩種不同的回購。

# list remotes 
git remote -v 
+0

所以我搞砸了..我可以做些什麼來解開這個?我從此沒有做過任何工作.. – vinayan