You are such a Git

I’ve been trying to migrate from using Subversion to Git for my version control. If you need to keep track of the different stages in the development of some work (this usually refers to code but could easily be a paper), you should be using version control.

I’ve been using SVN (often called Subversion) for nearly 10 years and I’m sick of it, so I thought I’d give Git a try. The organization I work for (Las Cumbres Observatory) is a non-profit so we applied for a free organization membership of GitHub (an online repository which will keep all your revision history and has a snazzy web interface). The problem was we have lots of software projects and lots of revision history we didn’t want to lose by giving up on SVN.

Fortunately, lots of people are in this position so there is a project called SVN2Git which will do the hard work of porting all your SVN history over to Git formatted history. It will even change your SVN users to GitHub users for a little more interactivity.

Step 1.

Install svn2git – You’ll need to have “git svn” installed. I’m on a Mac so I had to install Git from Homebrew, not from the .pkg distribution to get svn git.

Step 2.

Create a new directory/folder for the files you will convert from SVN to Git.

Step 3.

Set up an authors file in the correct GitHub format. This will translate your SVN users to GitHub users. You need to have every user who made commits on the SVN project using GitHub. I saved it as authors.txt in the current directory. The format is as follows

Step 4.

You will then run svn2git on your repository (not your local working copy) which will checkout a copy of the whole repository (trunk, branches and tags) and all the revision history. It will then convert all of that into Git format.

Step 5.

Create a repository on GitHub, and tell your newly Git converted project to point at your GitHub repository:

Step 6.

Merge your  newly converted project with the blank repository you created in step 5.

I had to “pull” down a copy of the files from GitHub (which were just the .gitignore and README.md files). Without doing this step I had lots of errors including SSH port 22 fatal error – sounds more alarming that it really was (Git is a bit of drama queen).

Next you will merge the files that svn2git converted for you,

All of your files should have made it into GitHub, complete with committers linked to GitHub users and a full verion history.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">