Search code examples
gitgitosis

Possible to check out a specific branch using gitosis


I have gitosis setup and working wonderfully using ssh. git@domain.com:repository.git works just as expected. Can clone, push, pull, etc.

I was wondering if I can use git to pull a specific branching however. git@domain.com:repository.git/somebranchname for example

didn't know if this was possible and haven't found any examples so I'm guessing no, but not sure.


Solution

  • No, when you clone a Git repo, you get everything (all tags and branches). However, they'll be stored as remote branches. Assuming the name of the remote is origin (which it is by default), you can checkout a local branch using:

    $ git checkout -b somebranchname origin/somebranchname
    

    which will create a local branch called somebranchname that contains the contents of somebranchname in Gitosis' copy of the repo. It will also "track" the remote branch so git pull will continue to pull in the latest changes.