2011-01-12 25 views
9

我並不完全確定導致這種情況的步驟,但是如果沒有我的GIT主分支,我已經結束了。我已經失去了我的主分支,並根據GIT,我的頭(儘管我可以告訴它)。我如何讓他們回來?

我在使用這裏的說明修復東西時發現了一個問題:http://sitaramc.github.com/concepts/detached-head.html但是我對GIT的一般無知可能會讓我陷入比起步更糟糕的境地。

$ git branch 
    first-cucumber-attempt 
    notifications 
* second-cucumber-attempt 
    sendgrid-setup 

在某些時候,我似乎開始在一個分離的頭的工作,現在我不知道怎麼找到我的主人(我覺得自己像愛麗絲有點現在)。

試圖結帳大師給出:

$ git checkout master 
    error: pathspec 'master' did not match any file(s) known to git. 

試圖拉主給:

$ git pull origin master 
From github.com:petenixey/kind-advice 
* branch   master  -> FETCH_HEAD 
Already up-to-date. 

分支,「second_cucumber_attempt」擁有所有的代碼我要合併到主,主是在github上仍然安全,但我無法實現。我徹底卡住了。

+1

+1「我現在感覺有點像愛麗絲。」 – thomasd 2013-08-02 16:27:56

回答

16

git checkout master中的「主」應該是一個你沒有的分支。您可以使用git checkout origin/master -b master結賬遙控器的主人,並將其設置爲您自己的主人,並將其設置爲「追蹤分支」。

您可以使用git branch -r查看遠程分支機構的列表。

+0

這完成了完美的工作,謝謝 – 2011-01-13 11:52:48

相關問題