Posts

Showing posts from May, 2017

Migrating SVN to Git with Branches

Image
In my previous post I did a simple migration of a Subversion project to Git.  I didn't want to keep any branches or history so purposely got rid of the history - it was more of a copy than a proper migration.  This time I will show you how to pull across some branches, and check that your commit history survives.

Instead of starting with an export of the SVN project, we can use a Git tool designed for Subversion.  Run this command to tell Git where your SVN repo is, and a little about its structure:

git svn init http://svn.example.com/subversion/Project ↩ --prefix svn/ -T trunk --b=branch --t=tag Initialized empty Git repository in C:/tmp/Project/.git/
My repository had slightly odd names for the branches and tags folders so I had to use the --b and --t flags tell Git what where to look.  Next you can associate any Subversion accounts with the new Git logins.  To do this, create an authors.txt file, formatted like this:

svn_username = Git User <git@fantail.io> svn_user2 …

Migrating from Subversion to Git

Image
I've been helping a company move its source code from Subversion to Git recently to support their Agile transition. They're moving their build, issue tracking and code repos to Visual Studio Team Services (VSTS). This is the cloud-hosted version of Microsoft's Team Foundation Services, with built in Git hosting, build tasks and a Jira-like issue tracking system. I really like it, plus it's free for teams of 5 or less, making it perfect for my development needs at home. Check it out at VisualStudio.com

 Most of my customer's projects don't need to keep their Subversion history - unfortunately they had no policy for commenting commits and most check-ins have empty messages so aren't of much use. The teams have made a conscious decision to abandon the past and drop the history. We will keep the old SVN repos alive for a while so if we really need to we can look back at changes, but don't expect to use it much. The simplest way to migrate these proje…