How do I convert my Subversion (SVN) code repository to git?
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