Victor Walch Michnowicz

is a web application developer

Convert A SVN Repo to a Git Repo March 22nd, 2011

Does This Really Deserves a Blog Post?

Converting an SVN (Subversion) repo to Git is pretty straightforward. However, I thought I would point out one small tip.

The Story

Once upon a time I had a SVN repo on my Ubuntu 9.10 box. I created regular SVN dumps as a form of backup. I then decided to do a clean install of the latest version of Ubuntu (10.10).

Since I was starting fresh, I decided to ditch SVN for the love of my life — Git.

The Issue

Since I was starting with a clean install I didn't have SVN configured at all. Lucky, this really does not matter. Here is the code for converting an SVN repo to Git:

git-svn clone https://svn.yourhost.name/my_project my_project.git

But since SVN is not configured, we don't have a URL to our SVN project. And if you try inputing an absolute URL to the backup, /home/victor/project/my_project, GIT will give you a nasty error. The trick is to use file:///. (Have a look at some of the many ways to configure SVN)

With file:/// we can do something like this:.

git-svn clone file:///home/victor/project/my_project my_project.git

Now you can live happily ever after.


blog comments powered by Disqus