XP-Dev.com Documentation

Converting Subversion Repository to Git

There are two ways to convert a Subversion repository to Git. It really depends on whether your current Subversion repository follows the standard layout with trunk, tags, branches folders at the root of your repository.

If your Subversion repository does follow that scheme, and you would like to preserve your tags and branches, then you will need to do some additional work.

The simple approach

git-svn is part of most Git distributions. Once it's installed, converting your repository is as simple as running:

$ git svn clone http://svn/repo/here/trunk

This will produce a new Git repository which can be used like any Git repository. However, this simple approach will preserve your current Subversion author usernames, and does not preserve your tags and branches.

Converting Users, Tags and Branches

This assumes that your current Subversion repository uses the standard layout with trunk, tags and branches at the top level of your repository.

Create a new file called ~/authors.txt (or any other name) that maps your Subversion users to your Git name/email combination:

user1 = First Last Name <email@address.com>
user2 = First Last Name <email@address.com>

You can then clone the Subversion repository using git-svn:

git svn clone --stdlayout --no-metadata -A ~/authors.txt http://svn/repo/here

Seeking Help

We (xp-dev.com) can do this for you as we have done many conversions in the past. Please do contact us for a quote.

Feel free to contact us if you need any assistance.