Convert From Subversion To Git

Like all the other cool kids these days, I’m slowly migrating all of my subversion repositories to git. Here’s how you can migrate too (this post also serves to remind me next time I need to import from an svn repository to a git repo):

Remote Git Repository
(Assuming you are running your own repository)
mkdir myproject.git
cd myproject.git
git init

Local Computer 
git svn clone -s YOUR_SVN_REPO
cd your_repo
git remote add origin REMOTE_GIT_REPO
git push origin master

Using Your Local Repo
You’re almost set, but probably also want to wire up your master branch on your local repository with the master branch on the remote repo. To do this you’ll need to edit your your_repo/.git/config file and append the following to the file:
[branch "master"]
remote = origin
merge = master

Now when you “git pull” everything will hopefully just work.

Tags:

Leave a Reply