开发者

Possible to check out a specific branch using gitosis

开发者 https://www.devze.com 2023-01-12 10:47 出处:网络
I have gitosis setup and working wonderfully using ssh. git@domain.com:repository.git works just as expected. Can clone, push, pull, etc.

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 s开发者_JAVA技巧ure.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消