tracking a different branch on github

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

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

  • best/simplest way to keep multiple (non-bare) Git repos in sync
  • error: cannot run ssh: No such file or directory when trying to clone on windows
  • Gradle dependency causing error “Invalid Magic Number”
  • git clone into home directory
  • Git-diff to HTML
  • How to view the changes in a single file in GitHub?
  • 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

  • Find files that were conflicting or locally edited during git merge commit
  • Git asking for password.
  • git commit deleting all files in repo
  • How To Revert Changes made by Some User in GIT Repository
  • CSS and Images on Heroku broken after push
  • Reverting an interactive git rebase
  • One Solution collect form web for “tracking a different branch on github”

    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.

    Git Baby is a git and github fan, let's start git clone.