---
title: "How to use SVN and Git together to get the best of both worlds in Windows"
url: https://thecancerus.com/how-to-use-svn-and-git-together-to-get-the-best-of-both-worlds-in-windows/
date: 2009-08-17
modified: 2009-08-17
author: "ican"
description: "I have been using SVN to manage my source code for last three years, I can say I am quite happy with it, except for one problem, it was not..."
categories:
  - "how too?"
tags:
  - "git"
  - "git-svn"
  - "svn"
word_count: 388
---

# How to use SVN and Git together to get the best of both worlds in Windows

I have been using [SVN](http://subversion.tigris.org/) to manage my source code for last three years, I can say I am quite happy with it, except for one problem, it was not possible to commit the code unless I was directly connected to my office network.

Then I heard about DVCS and [Git](http://git-scm.com/). I found solution to one of my big problem, ability to commit code while I am not connected to office network, and share code with my teammates.

Their was only one small problem we didn’t wanted to loose the benefits of centralized repository, and we use Windows  OS( let’s not get into windows vs linux, i will win). So last 3-4 months I was looking for different DVCS systems with better windows support and i experimented with Mercurial (TrototoiseHg is good), but i think Git wins the race of DVCS hands down, and with popularity of GitHub I don’t see much choice here.

And finally I found about [git-svn](http://www.kernel.org/pub/software/scm/git/docs/git-svn.html), and I was on my way.

Here are the commands and steps that you can use to manage Git and SVN together.

- Create a working copy(or actually a git repository ) using
git svn clone –s <path to ur svn rep, eg https://akjoomgallery.googlecode.com/svn/trunk/>

- Get the source from svn repository to your git repository using
git svn fetch
(only needs to be done first time, it is slow and time consuming process)
- When you need to update your working copy  you use
git svn rebase

- When you need to commit back to svn repository just use
git svn dcommit

I used above commands in Git bash shell that comes with Git.

Also note their would be time when we have some changes in the Git repository that is not yet ready for commit, but we need to update our repository and Git won’t let you do that, without committing them (rebase will always give error) in such situation you use following set of commands
git stash

git svn rebase

git stash apply

git stash clear
Update:

And if you don’t want to these things manually here is my favourite tool that does that using nice GUI and perfect windows integration [TortoiseGit](http://code.google.com/p/tortoisegit/)

I have written this a month back before I found TortoiseGit, so this is now just for reference, and to get me back to my blogging.

Have fun.