View Source

As the code in the shared repository matures, we expect that it will be sensible to clear out parts of the code-base and move them into dedicated projects. Here is an example of how this can be done, based on the information provided [here|http://stackoverflow.com/questions/1662753/export-subtree-in-git-with-history].
{info:title=Master Branch Only}Note that this will only correctly clone the master branch.{info}

* Make a local clone of the shared repository:
{code}
git clone [email protected]:openplanets/scape.git scape-nanite-original
{code}

* Use git-filter-branch to strip out everything except the contents of one folder, which becomes the root of the repo:
{code}
git filter-branch --subdirectory-filter pc-cc-nanite -- --all
{code}
Note that this will not discard everything yet - the 'bulk' will still be there.

* Create a new repo, then overwrite the original remote and push to that new location
{code}
git remote rm origin
git remote add origin [email protected]:openplanets/nanite.git
git push -u origin master
{code}

* Now clone that new repository into a new directory (should be smaller now)
{code}
git clone [email protected]:openplanets/nanite.git nanite
{code}

So now, if we look at disk usage:
{code}
$ du -s scape*
864332 scape
1752 nanite
513472 scape-nanite-original
{code}

You can then remove the old folder, from a DIFFERENT copy of the original shared repository (I'm not bothering to wipe the whole history though)

{code}
git rm -r pc-cc-nanite
git commit -m "Removed Nanite files that have been moved to a new repo."
git push
{code}