Nick Carroll

Metabolising caffeine into code

Switching from Subversion to Git

without comments

I got bored of Subversion and decided to move my subversion repository over to Git. It was actually quite simple if you use git-svn.

The first thing you need to do is set up your git repository on the server. So log into your server and enter the following command to create an empty git repository for your application called “appname” (replace appname with the name of your application).


$ mkdir -p ~/git
$ mkdir -p ~/git/appname.git
$ cd ~/git/appname.git
$ git --bare init

Now on your local machine you will need to use the git-svn tool to clone your subversion repository as a local git repository, then push your local repository to the master branch on your server. So on your local machine enter the following on the command line (I’m assuming you are using Ubuntu Linux, naturall). Replace svn_repo_url with the actual url of your svn repository. Replace username with your actual username on the server. Replace local_appname with the name of your application.


$ sudo apt-get install git-svn
$ mkdir projects
$ cd projects
$ git svn clone svn_repo_url local_appname
$ cd local_appname
$ git remote add origin username@domainname.com:/home/username/git/appname.git
$ git push origin master

Switching to Git is as easy as that!

Written by Nick

September 5th, 2008 at 12:11 am

Posted in Programming

Tagged with

Leave a Reply