archive for March, 2014

Migrating from SVN to Git

I’m in the process of cleaning out my old PC and moving the content over to my iMac.  As part of the process, I’m converting an old Subversion repository that held a bunch of my side projects into several smaller Git repos.  Here’s the general flow for each of my projects (Warning: these notes are really just for me.  I’m still learning git and am probably doing this wrong.):

git svn clone svn://localhost/ –username=aaron –preserve-empty-dirs –authors-file=authors –no-metadata –include-paths=”^path/to/project1″ project1

cd project1
git filter-branch --prune-empty --subdirectory-filter "path/to/project1" HEAD

I repeated that  a few times, then to get the miscellaneous scraps, I did:

git svn clone svn://localhost/ --username=aaron --preserve-empty-dirs --authors-file=authors --no-metadata --ignore-paths="^path/to/(project1|project2|project3)" misc_svn

cd misc_svn

git filter-branch --prune-empty

I don’t know if that last step was required.

Once I had working git repos on the PC, I shared the directory that contained them all, and connected to that folder from my Mac.  Once connected, I could easily clone them with:

git clone file:////Volumes/git/project1/

So far, it looks like it worked well.  Each project has just the parts of the log that it needs, but it still retains the history.