# How to reorganize git tree

3 messages from 2012-01-26 to 2012-01-26. Participants: Alan Edwards, Ben Walton, Jakub Narebski.
Thread: https://gitlist.dev/t/29449

## Alan Edwards, 2012-01-26 18:35

Subject: How to reorganize git tree
Message-ID: <20120126133505.it34vehs0044o848@webmail.xnet.com>
URL: https://gitlist.dev/e/20120126133505.it34vehs0044o848%40webmail.xnet.com

```
I was new to git about a year ago and created a git directory  
structure containing several different projects like:

/source/web_server1/project1
/source/web_server1/project2
/source/web_server1/project3
/source/web_server1/project4
/source/web_server2/project5
/source/web_server2/project6

where my massive .git repository is:

/source/.git (containing all the projects on all the web servers....  
Oops!) There seems to be lots of "loose objects".

Somewhere along the way I figured out that this probably wasn't a good  
idea and I ended up making a git repository under one of the projects:

/source/web_server1/project4/.git

Not sure if that was the best decision either. I've already checked in  
changes to the /source/web_server1/project4/.git repository for  
project4 and I've checked in changes to project2 into the /source/.git  
repository.

Of course I now realize the errors of my way and would like to restructure.

the only changes that have been checked into the big upper level  
repository are changes for project2.  Is it possible to carve out  
those changes from the /source/.git repository and create a new  
/source/web_server1/project2/.git repository?

Maybe the way to deal with this is to remove the other directories  
from the /source/.git repository and leave project2 there.

Any one have any suggestions?

I'm not sure if I'm posting this in the right place (I'm at work and  
they don't allow access to many places and I don't have access to the  
news group).

Thanks!

-Alan Edwards
  kae at xnet dot com (my home email address)

```

## Ben Walton, 2012-01-26 18:57

Subject: Re: How to reorganize git tree
Message-ID: <1327604128-sup-1697@pinkfloyd.chass.utoronto.ca>
URL: https://gitlist.dev/e/1327604128-sup-1697%40pinkfloyd.chass.utoronto.ca
In-Reply-To: <20120126133505.it34vehs0044o848@webmail.xnet.com>

```
Excerpts from Alan Edwards's message of Thu Jan 26 13:35:05 -0500 2012:

Hi Alan,

> Any one have any suggestions?

I think that git filter-branch is going to be your friend here.  I
won't prescribe the details as you should definitely read and
understand the docs for this one, but things like
--subdirectory-filter and/or --tree-filter will be of great use to
you, I think.

Hope this helps.

Thanks
-Ben
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

```

## Jakub Narebski, 2012-01-26 23:27

Subject: Re: How to reorganize git tree
Message-ID: <m3ehumdoxs.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3ehumdoxs.fsf%40localhost.localdomain
In-Reply-To: <1327604128-sup-1697@pinkfloyd.chass.utoronto.ca>

```
Ben Walton <bwalton@artsci.utoronto.ca> writes:

> Excerpts from Alan Edwards's message of Thu Jan 26 13:35:05 -0500 2012:
> 
> Hi Alan,
> 
> > Any one have any suggestions?
> 
> I think that git filter-branch is going to be your friend here.  I
> won't prescribe the details as you should definitely read and
> understand the docs for this one, but things like
> --subdirectory-filter and/or --tree-filter will be of great use to
> you, I think.

Third-party git-subtree tool can also help here, I think.

-- 
Jakub Narebski

```
