How to convert your svn repo to git
April 3rd, 2008
Everyone loves git (unless you love mecurial), and svn is so passe, so it’s time to hop on the bandwagon!
Step 1: Install Git. I use macports.
# sudo port install git-core +svn
Others may want to use one of these commands:
# sudo apt-get install git-core
# yum install git-core
# emerge -av git
# sudo pkg_add -i git-svn
# sudo pkg_add -r git
Step 2: Check out your svn project with git. This may take a while, my project took about 20 minutes and it has 1300+ commits.
# git-svn clone https://svn.yourhost.name/projectname projectname.git
Step 3: Get any commits that may have been made to your subversion repo while you were exporting it.
# git-svn rebase
Now you’ve got a functional git clone of your subversion repo. git commands are very similar to svn commands. For example:
# git commit -a -m "This is a commit message"
# git help (to learn about more commands)
If you want to commit the changes you have made to your git repo to your svn repo, it’s quite easy:
# git-svn dcommit
This article is also published on Learnhub
1 Response to “How to convert your svn repo to git”
Sorry, comments are closed for this article.



April 10th, 2008 at 10:37 PM Hi Wesley, I installed your ensures_immutability plugin a couple of days back and ran into a problem. I tried posting at the Savvica site, but was getting a Service Unavailable response. The problem is that validation failed when using the new method. I traced the problem to line 23: read_attribute(attr_name).nil? ? write_attribute(attr_name, new_value) : raise(ActiveRecord::ImmutableAttributeError, configuration[:message]) Apparently, read_attribute returns blanks instead of of nils for me. I'm not very familiar with the source, but judging from the read_attribute method, it could be returning blanks when we save a model after using the new method, hence the exception being thrown. I'm guessing that your plugin only works when using the create method. To make it work in my case, I've edited that line to this: read_attribute(attr_name).nil? or read_attribute(attr_name).blank? ? write_attribute(attr_name, new_value) : raise(ActiveRecord::ImmutableAttributeError, configuration[:message]) It now works with both new and create. This creates another hole in that if the initial value is blank, we would be able to change it. However, I can't think of any scenario where we allow users to set an immutable attribute to a blank value (and not allow changes after that). So this might be a feature instead =) Good work!