We already had plans to migrate SVN to GIT for a while now in EM, but we just never found a chance to do it. Last week we had a major outrage in our Primus data center, which hosts all our development tools, including JIRA, SVN, Bamboo, and all the VM machines for development purposes.

The outrage took quite a few days to recover, and as a result,  our head of engineering decided to migrate all our  SVN repository to GIT in BitBucket.

The tool we used is called svn2git, it provides very easy command line tool for us to check out all the files under a repository, and then import all histories into GIT in no time, well, depends on the size of your repository of course.

This tool provides several features that allow you to include either tags or branches, or simply only trunk, and also allow you to exclude some files based on regular expression patterns. It is quite a handy tool for this kind of migration. Sample commands includes:

svn2git http://svn.example.com/path/to/repo
svn2git http://svn.example.com/path/to/repo --trunk dev --tags rel --nobranches
svn2git http://svn.example.com/path/to/repo --trunk trunk --nobranches --notags
svn2git http://svn.example.com/path/to/repo --rootistrunk
svn2git http://svn.example.com/path/to/repo --exclude doc --exclude '.*~$'
svn2git http://svn.example.com/path/to/repo/nested_project --no-minimize-url

For further installation and usage instructions, please refer to their github home page.

Leave a Reply

Your email address will not be published. Required fields are marked *