Deserting SVN for good: Using Git

I've been having tremendous amount of problems lately using TortoiseSVN. Although server seemed to work fine, my SVN client had lots of problems, so I decided it was time to switch to Git. I was using the free service available at xp-dev but the free service only includes SVN repositories, so I tried the next best thing: GIT-SVN. Let's see how it worked out for me.

Git is not (yet) natively supported on windows. The only way to run it on Windows was to use Cygwin, a linux like environment for Windows, but the new project called msysgit is trying to make a native Windows client. To get started download and install msysgit from google code. I'm using version 1.6.5.1 preview 20091022 at the time of this post, but it is updated regularly.

To connect to SVN repository, open a Git Bash window on your destination folder and enter the following command:

git svn -s clone http://your-svn-address

If your SVN repository has no standard folders such as "trunk", "tag" and "branch" you should remove "-s" parameter. This command would get all the sources, except empty folders in your existing SVN repository because Git does not track folders but file content.  It would take some time for git to get all the revisions but when it finishes, you're all set.

From this point on, you can use git commands but before committing changes back into your SVN repository, you should update your working folder by the following commands:

git svn fetch
git svn rebase

This will update your local git working copy by getting all the changes made by other people and then applies your local changes over that.

The last command to send your changeset to the SVN repository is the following:

git svn dcommit

To find out more about git commands, try this cheat sheet that comes handy.

No Comments

Add a Comment