From the monthly archives: December 2007

You just installed git. Now it’s time to set it up. First, you want to set up your name and email, which will be added to your commits:

$ git config --global "Your Name"
$ git config --global

Another useful option is alias. We can also use the command line to set it or we can edit ~/.gitconfig:

	st = status

This means we can just type git st instead of git status. As you get more familiar with git, you’ll want to add your own aliases.

Check the manual for the complete list of options.

Change gitk fonts

Gitk looks bad. Really bad. We can improve it by changing the default font. You need to edit ~/.gitk:

set mainfont {Monaco 10}
set textfont {Monaco 10}
set uifont {Monaco 10}

Much better.

Bash completion

Lookup contrib/completion in the git source directory. Git-completion.bash includes the instruction to set it up. You need to copy that file somewhere and source it in your ~/.profile. Once this is done, you can press tab to complete git commands, options and the name of branches in bash. The script also adds __git_ps1 which you can use in your PS1 to include the name of the current branch in your bash prompt. Because you will use branches with git, it can help you remember that you switched branch just before leaving work the day before.

Popularity: 52% [?]


Note: These instructions are for Mac OS 10.4. I don’t know if they’ll work with Leopard.

Installing git is easy, just compile from the source. Git svn is harder to install because it is a bunch of perl scripts that needs the svn perl bindings (it comes with git btw). Here are the steps I recommend to make sure everything works.

First, we’ll install git using Macports. This will take care of installing all the required perl libraries:

$ sudo port install git-core +svn

However, macports installs a slightly old version of git. So I suggest downloading the latest and compiling from source.

$ sudo make install
 # Note: watch out for the way your PATH is setup
 # to make sure you are using this new git version
 # instead of the macports version
$ git --version

Now if you try to run git svn, you might get an error about it not finding SVN/ That means your version of subversion does not include the perl bindings (which is the standard if you installed svn with macports). I suggest you install subversion from this package that includes the language bindings. Now you need to add this to your ~/.profile:

export PERL5LIB=/usr/local/lib/svn-perl

Everything should work. Now it’s time to import your svn repositories and enjoy git.

Popularity: 58% [?]


I’ve been using git for three months now and it has had zero impact on my team. They weren’t even aware I was using it for the first few weeks. That means, you can start using it now, for your personal development, without having to convince anybody.

Git comes with a svn wrapper. You can import your svn repository to a local git repository. You then get all the advantages of git: easy branching/merging, offline operation(very useful if you work with a laptop), etc.

$ git svn clone http://path/to/svn -T trunk -t tags -b branches

This command will import all the revisions from svn and create branches in your git repository (one for trunk, and one for all your branches). You will be on a branch master (linked to trunk) and can start working. You commit normally to your repository.

When you are ready to send your changes back to svn:

$ git svn rebase # (equivalent to svn update)
$ git svn dcommit # (equivalent to svn commit)

Rebase works by reverting your changes, getting the latest revisions from svn, and then reapplying your changes. You resolve any conflicts (if there any). The last command then pushes your changes to svn for your team to enjoy.

Those are the three commands you need to know to use git with svn.


Svn:externals are not supported. I suggest you use piston to handle them.

Check out the git svn docs for a few more things to watch out for.


Now that your team has seen you using git successfully for weeks, it will be much easier to get them to switch!

Popularity: 21% [?]


Rails developers will switch to Git because just like Rails is ten times better than any java( or .Net) framework, git is ten times better than subversion.

I will be presenting git at the next Montreal On Rails. You may want to wait for my presentation to switch to git, but that means going a whole month without benefitting from git’s awesomeness. So here are a couple of links to get you started:

That should be enough to get you started. Make sure you listen to Linus’ talk. It’s one hour long, but it’s definitely worth it.

Popularity: 26% [?]


Deployment, deployment, deployment. Ok not three, but just two awesome presentations on deployment.

Carl Mercier, Rails Deployment Option

Carl compared the different hosting solutions available for Rails. You want to avoid shared hosting and start with a Virtual Private Server(VPS) so you get enough RAM to run a couple of mongrels. Carl has had good experiences with Slicehost. A dedicated server is the next step if you need more power, but you might want to skip it and go directly to the next option.

Amazon EC2. The game changer. Take all the advantages of server virtualization and add on demand power when you need to scale. Check out EC2 on Rails. It contains a complete image already setup for rails. Also check out Rightscale. They have a nice dashboard to help you manage your instances.

Mehdi Adda, Setting Up Your Server

Mehdi showed how to setup mongrel+nginx+seesaw+monit. Mongrel acts as the app server. Nginx is a lightweight and fast web server. Seesaw allows you to restart your mongrel cluster with no down time and always only one version of your app running. Monit supervises your processes and can kill them if they have a problem, restart them if they crash or send you a warning email if you’re running out of disk space.

Check out Mehdi’s slides. They are very thorough on the steps to setup each part. You can get the slides on the Montreal On Rails website.

Next edition

The next is scheduled for the middle of January. I’m wondering if people would be interested in a presentation on git. It is not strictly rails related, but should be of interest to all rails developer. I’ve been using it for almost three months and it rocks. In fact, I’m going to make a prediction: 80% of all rails developer will switch to git before the end of 2008.

Popularity: 25% [?]