Setup git-flow on Mac OS X Lion

git-flow is a branching model to keep your git repository in shape, and the author @nvie also released it as git extensions, so that you can easily convert your git repository into git-flow branch structure and keep maintained (with ease).

Below are the steps I setup git-flow on my Mac OS X Lion:

MacPorts and bash-completion

  1. Install Xcode
  2. Install MacPorts
  3. Install bash-completion

    % sudo port install bash-completion

  4. Add following line into .bash_profile, so that you can use default completions

    [ -f /opt/local/etc/bash_completion ] && . /opt/local/etc/bash_completion

git-bash-completion and git-flow-completion

After bash-completion is ready, you still need two additional completions before installing gitflow extensions.

  1. Install git-bash-completion

    % curl -O -o ~/

  2. Enable git-bash-completion by adding following into .bash_profile

    [ -f ~/ ] && . ~/

  3. Install git-flow-completion

    % curl -O -o ~/

  4. Again, add following into .bash_profile to enable it

    [ -f ~/ ] && . ~/

git-flow extensions

Once you completed steps above, the git and git-flow completions are integrated into bash, so we can proceed to the final step, install the git-flow git extensions:

% git clone --recursive git://
% sudo make prefix=/opt/local install

That’s it.

For usage, read this article.


If you don’t mind installing dependent packages, you can use:

% sudo port install git-flow

Which saves lots of times, if it doesn’t break build.


  1. howibecameagrunt reblogged this from digdog
  2. zhou533 reblogged this from digdog
  3. digdog posted this