Monday, June 28, 2010

Using Git with SVN repositories

I've been using Git with SVN repositories for a while now. And for the most part it's good, really good.

If you want an introduction on where to start I suggest you read Emmanuel Bernard's entry on this exact topic. It's simple, to the point and will get you started in no time.

Today though I got bitten by some rather strange 'bug' of Git SVN. My master branch wasn't linked to remotes/trunk as I always expect. Apparently the branch that was last commited to (in SVN) is the one that gets linked to master.

Thankfully there is nothing that a quick Google search can't fix. And I found that one just has to issue the following command to fix that:

git reset --hard remotes/trunk

Thanks to Horst Gutmann for posting this before me.

Update:

A simple way to know what master is linked to is to issue the following command right after you cloned your SVN repository:

git svn dcommit

It will actually tell you where it is going to commit anything that should be.