Working with a Subversion repository through Git

25 May, 2009 - 13:53
Categories:

I'm experimenting with using a Subversion repository through Git. That way I can keep better track of my own (experimental) work, without polluting/destabilizing the central Subversion repository with small incremental commits. Git comes with a svn sub-tool that takes care of all the interfacing between the local git repository and the central Subversion repository. Mainly for my own reference, I'll collect some pointers and tricks for using this git-svn tool here. Maybe it's useful for other too.

Check out/import/starting

Create a fresh git-svn working copy/repository, and tell it where the subversion repository is:

mkdir marsyas-git-svn
cd marsyas-git-svn
git svn init https://marsyas.svn.sourceforge.net/svnroot/marsyas/trunk

This will download nothing. Use the fetch command to so. As importing the whole subversion history is not recommended (it could take a lot of time), you should specify from which subversion revision you want to start tracking:

git svn fetch -r3463

Daily usage

Getting the latest revision from subversion (like svn update):

git svn rebase

Commit your local changes, you've been managing with git:

git svn dcommit

Further reading

http://flavio.castelli.name/howto_use_git_with_svn
http://utsl.gen.nz/talks/git-svn/intro.html