A productive development environment

Written in Productivity by Marc Riera — February 22, 2011

How to easily setup our development stack based on vim, git, zsh and git-flow

Updated: Peter Aronoff suggested an update for the brew formula for vim. Thanks!

Every programmer has their own way to set up a programming environment, and usually has to set it up several times in different machines. So that is how we set it up in Codegram.

What we use

Installing ZSH

So let's go. First of all, we're gonna install ZSH, install the oh-my-zsh framework and define it as the default shell:

$ brew install zsh
$ wget http://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
$ chsh -s /bin/zsh

Note that you will need wget installed with brew install wget to install oh-my-zsh the fast way. If you want, you can find the manual instructions on the Github project's page.

An interesting feature coming with oh-my-zsh are plugins. By default, the git plugin is enabled. This plugin has some really useful alias:

  • ggpull, which is an alias of git pull origin ($current_branch), where $current_branch is the name of the project branch you are on,
  • ggpush, which works pretty much like ggpull... but pushes to your origin repo, and
  • ggpnp, which equals to ggpull && ggpush.

VIM, that freaking editor

If you are not using VIM already, you should really start using it. Let's install it together with Codegram's vimfiles:

$ brew install https://gist.github.com/raw/721952/335334bba22da294a06eb7bdf02722acbf51cab2/vim.rb
$ cd
$ git clone http://github.com/codegram/vimfiles.git .vim
$ sh .vim/install.sh

As you may know, VIM is a really powerful and fast code editor, but you need to get used to it to code fast. A good way to start is taking a look at these cheatsheets. The reason to install Codegram's vimfiles is that they bring a lot of plugins. You can find the plugins usage in the documentation.

Note that VIM is a terminal editor, so say goodbye to your mouse :)

Ruby Version Manager and GIT

Let's suppose you are creating an open-source application and you need to test it under Ruby 1.9.2 and 1.8.7. So you should install Ruby 1.8.7, test the application, install 1.9.2, test it again... Ruby Version Manager (RVM) allows you to have different installations of Ruby living together, each one with its own gems. To install it, we'll need GIT, which is so famous that I will just say that it allows you to track the development of a project through branches and commits.

$ brew install git
$ bash << ( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
$ rvm install 1.9.2
$ rvm install 1.8.7

GIT Flow

The best way to release stable features fast is to have a well-defined version control flow. That is why we use git-flow to organize our git branches.

This nifty tool follows the conventions introduced by Vincent Driessen in his article a successful Git branching model.

The easiest way to install git-flow is to use brew again:

$ brew install git-flow

Once installed, you have to initialize your repo to use git-flow first:

$ git flow init

We're sticking to the conventions there: master for the stable releases, develop for features waiting to be pulled into production, feature as a feature prefix for new features and support & hotfix for support branches and hot fixes into master as well.

From then on, you can use the built-in commands to easily start and finish features, and tag releases as well.

$ git flow feature start <name> [<base>]
$ git flow feature finish <name>
$ git flow release start <release> [<base>]
$ git flow release finish <release>
$ git flow hotfix start <release> [<base>]
$ git flow hotfix finish <release>

You can learn more about its options in git-flow's github repo.

View all posts tagged as