tags:

views:

282

answers:

1

I am trying to track a different branch of a github project. The project is restful_authentication:

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

However, what I really want to clone is the modular branch:

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

I found this guide:

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

and tried a few commands like:

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

and

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

but I am getting the following error:

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

Any thoughts on the correct way to do this?

Thanks

+4  A: 

You cannot just clone a branch, you have to clone the full repository:

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

Then you can use a tracking branch in your local repository:

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

Note that, after cloning, git has set up a "remote" with the name "origin" for the remote repository and "origin/modular" identifies the "modular" branch of the "origin" remote.

Ferdinand Beyer