4

Is it possible to take a 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.

BeesonBison
  • 1,053
  • 1
  • 17
  • 27

3 Answers3

7

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.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • Thanks, this is exactly what I wanted to achieve. I was wondering though - if I do a 'git pull' on the master, this works great - how would I pull down updates on the 1.2 / 1.3 branches? – BeesonBison Jan 14 '10 at 10:15
  • After doing a `git pull` on the master, do a `git pull` on the 1.2/1.3 branches, which will pull from master (due to *their* tracking branches). Or, you could add github as a new remote to the branch repositories and pull directly. Git is like Perl - there's more than one way to do it! – Greg Hewgill Jan 14 '10 at 17:44
0

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.

Antony Hatchkins
  • 31,947
  • 10
  • 111
  • 111
0

Somehow related to this ?!

Community
  • 1
  • 1
Stefan Näwe
  • 3,040
  • 1
  • 18
  • 19