March 11, 2010

GIT - Working with a SVN repository

Git a SCM created by Linus Torvalds and currently mantained by Junio Hamano, is a distributed revision control system very simple and extremely powerful.

For those people who want to test this system (me included), and comes from a SVN environment, there are some utilities (included with GIT) to interact with SVN repositories.

In my case, I have a copy of a project fetched from the SVN repository, and for local development I use a branch called 'development'. When the development branch is stable, I merge this branch with the branch 'master', and then commit the changes to the SVN repository.

- Create and fetch from SVN repository
git svn init https://localhost/dev/svn/tiergen
git svn fetch -r HEAD
- Create a 'development' branch and start working with it.
git branch development
git checkout development
- After all changes are made in the development branch, let's merge thi with 'master'.
git checkout master
git merge development
- Finally, commit everything to the SVN repository.
git svn rebase # I always do this
git dcommit