This site runs best with JavaScript enabled.

SVN to Git

How to migrate a subversion repo to Git

I've been using Git now for over two years. Previously, all my source control was handled with subversion (SVN). To be honest, I can't even remember how to use SVN. To be more honest, I cheated and used TortoiseSVN most of the time anyway.

Every so often I want to update an old website, but my repo is in SVN. I don't even have it installed anymore. So what do I do? I quickly convert it to Git.

Most of my important repos are stored on my Unfuddle account. Fortunately, they support both SVN & Git. I recently converted an SVN repo to Git. Here were the steps I took (I'm using Ubuntu).

1mkdir svntemp
2cd svntemp
3git svn init --no-metadata
4git svn fetch

... wait for fetching ...

1cd ..
2mkdir newgitrepo
3cd newgitrepoÂ
4git init
5git remote add origin
6cp -R ../svntemp/trunk/* .
7git add *
8git commit -am "initial commit"
9git push origin master

And I think we're done here. Now, back to coding!

Discuss on TwitterEdit post on GitHub

Share article
Dustin Davis

Dustin Davis is a software engineer, people manager, hacker, and entreprenuer. He loves to develop systems and automation. He lives with his wife and five kids in Utah.

Join the Newsletter

Dustin Davis