开发者

Checking out the branches of a git repository into sub folders?

开发者 https://www.devze.com 2022-12-16 14:11 出处:网络
Is it possible to take a开发者_如何学JAVA repository (such as CakePHP1.x @ http://github.com/cakephp/cakephp1x) and checkout the master plus branches into sub-folders?

Is it possible to take a开发者_如何学JAVA repository (such as CakePHP1.x @ http://github.com/cakephp/cakephp1x) and checkout the master plus branches into sub-folders?

For example, my desired folder structure would be like this:

cakephp1.x

|------ 1.2

|------ 1.3

|------ master

I know you can use git checkout -t origin/branch to switch between branches from a cloned repository, but I was wondering if there was a way to do the above without having to clone the repository and rename repeatedly.


You could do something like this:

mkdir cakephp
cd cakephp
git clone git://github.com/cakephp/cakephp1x.git master
cd master
git checkout -t origin/1.2
git checkout -t origin/1.3
cd ..
git clone master 1.2
git clone master 1.3
cd 1.2
git checkout -t origin/1.2

The two local git clone operations will be very quick because they will use hard links to share most of the repository data.


cloning the repository is not a very big deal. If it happends on a local filesystem most of the repository contents is cloned via hard links.


Somehow related to this ?!

0

精彩评论

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

关注公众号