Thursday, 17 December 2009

Converting from subversion (svn) to git

Recently I've been migrating from Subversion (SVN) to GIT. Why? Well mainly because GIT doesn't require a server running in the background and you can have local working copies containing a full history.

So here's how to do it.

First go to the directory where you want your local files to be, if this is the same as your svn working copy location then delete all files (including the .svn folder).

Create an authors.txt file which contains the svn usernames you use i.e.

joe = Joe Bloggs <joe@bloggs.com>

You must put the email part in or it won't work.

Next run the following command

git svn clone <repo url> -T trunk -t tags -b branches -A authors.txt .

Poof you're done. That clones a subversion repository setting the trunk to /trunk branches to /branches and tags to /tags

Note: if you are on a case insensitive file system and don't empty the working directory then you may get warnings about overwriting files i.e. CHANGELOG and changelog, this appears to be because svn doesn't care about case but git does (correct me if I'm wrong but this happened to me on Mac OS X with HFS+ Journaled not case sensitive file system).


Thanks to http://pauldowman.com/2008/07/26/how-to-convert-from-subversion-to-git/ for the command

0 comments: