2009-10-26 90 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”分支。