Assorted Revision Control Systems

14 June 2008 11:00

I've recently moved to using git as my standard revision control system. I honestly don't know how it compares with most of its competitors, but I appreciate the ideas behind distributed revision control.

Today I had a project which I wanted to check into a subversion repository, so I thought I'd try to do things the hard way: use git-svn. It turned out not to be too bad to get the code checked in. First, I added this to .git/config:

[svn-remote "assembla/trunk"]
  url =
  fetch = :refs/remotes/assembla/trunk

Then the following did the work:

$ git-svn fetch assembla/trunk
W: +empty_dir: trunk
r1 = f59e10be7c3662088211b97cdfc7c8bf32fb0db0  (assembla/trunk)

$ git branch -a
* master

$ git checkout -b local-svn/trunk assembla/trunk
Switched to a new branch "local-svn/trunk"

$ git merge master
Merge made by recursive.

$ git-svn dcommit

And finally switch back to the master branch:

$ git checkout master

To commit further changes, commit to the master branch, switch to the local svn branch, merge, push and switch back:

$ git-commit -a -m"Fix the one test"
$ git checkout local-svn/trunk
$ git merge master
$ git-svn dcommit
$ git checkout master

Showing the current branch in the prompt

To show the current git branch in your prompt, edit it to look something like this:

export PS1='\[\033[1;36m\]\u@\h:\w\[\033[0m\]$(__git_ps1 "(%s)")$ '


git has proper command completion which you'll need to enable, like this:

ln -s /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_git-core/work/git- ~/
. ~/.git-completion.bash

And whilst we're on the completion theme, here's how to get sudo to do something sensible:

complete -c -f command sudo

Leave a comment