Subversion, Mercurial and Git

Since I am working in very different environments (office, university, home) which do not always share access, especially towards the source code repositories, I searched for a feasible workflow using a distributed source code management like Mercurial or Git for my local work (on my laptop) and the base subversion repositories from the headquarters. I simply needed more history and would like to be able to commit things into a ’travel’ intermediate repository while I am on the road and be able to check in the changes as soon as I have access to the base svn again.

I started believing that mercurial would be the system of choice, but its communication back to subversion seems to be non-mature at the time of this writing. This webpage makes a nice comparison of the different approaches available for mercurial-svn workflows. Anyhow, the book is very nice and interesting. If I would need to start a new project with my source code management system of choice, I would probably choose mercurial. Especially the built-in MQ extension looks really nice and seems to be very handy for people getting crazy with patches - maintainers maybe? ;)

After my short excursion on mercurial, I checked git yet another time, although I am not a big fan of Torvald’s polemic aggressions. Fortunately, it seems to do exactly, what I need - how ironic. As this blog about an git-svn workflow describes:

# clone the remote svn repository
git svn clone https://svn.xxx.com/project localdir
cd localdir

# some available commands
git status
git diff
git log

# to visualize the repository's contents
gitk --all

# checkout of master and
git checkout master
#  'rebase' (pull changes from svn)
git svn rebase

# commit changes
git commit -a -m'commit message' file.x
git svn dcommit

That’s it! :) It is essential to commit the change into your local git repo first along with the appropriate commit message. After that, the commits can be forwarded to the base svn repository, which seems to work as a glimpse :)

Cheers,
iss