Migrate to git your old svn or mercurial repositories

Hello nerds,

I started to use git as my default versioning tool since a couple of years.

After reading a book about git and exploring all the features you really don’t want to rollback to another versioning system.

So I used this tool to convert my existing mercurial repositories to git. It is quite easy using the fast-export tool that you can clone from here:

git clone git://repo.or.cz/fast-export.git

Because both Mercurial and Git have a copy of the entire repository locally, the migration process happens completely on the local host:

~/fast-export/hg-fast-export.sh -r ~/my-mercurial-repository/

For the svn repositories the process is very simple but takes a little of time for large repositories. You can clone a svn repository to git in this way:

git svn clone svn://repository.xxx/URL

This will make the git client to checkout from the server all the SVN revisions and create the local git repository. What is very useful is that you can now work in git, but you are still able to “svn commit” your changes to the remote svn repository.

this blog post is not a complete guide, read this book to have a complete reference: http://it-ebooks.info/book/919/

Saverio

This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

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