2009-10-26 93 views
1

我正在嘗試追蹤github項目的不同分支。 該項目是restful_authentication:跟蹤github上的不同分支

http://github.com/technoweenie/restful-authentication

不過,我真的想克隆是模塊化分支:

http://github.com/technoweenie/restful-authentication/tree/modular

我發現這個指南:

http://github.com/guides/showing-and-tracking-remote-branches

並嘗試了幾個命令:

git checkout --track -b lmod http://github.com/technoweenie/restful-authentication/tree/modular 

git checkout --track -b lmod git://github.com/technoweenie/restful-authentication.git/modular 

,但我收到以下錯誤:

fatal: git checkout: updating paths is incompatible with switching branches 

上的正確方法有什麼想法做到這一點?

感謝

回答

5

你不能只克隆一個分支,你必須克隆完整的存儲庫:

git clone git://github.com/technoweenie/restful-authentication.git

然後你就可以在你的本地庫使用跟蹤分支:

cd restful-authentication 
git checkout --track -b lmod origin/modular 

請注意,克隆之後,git已經爲遠程存儲庫設置了名爲「origin」的「remote」,「origin/modular」標識了「origin」remote的「modular」分支。