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
- Install Xcode
- Install MacPorts
% sudo port install bash-completion
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.
% curl -O https://github.com/git/git/raw/master/contrib/completion/git-completion.bash -o ~/.git-completion.sh
Enable git-bash-completion by adding following into
[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh
% curl -O https://github.com/bobthecow/git-flow-completion/raw/master/git-flow-completion.bash -o ~/.git-flow-completion.sh
Again, add following into
.bash_profileto enable it
[ -f ~/.git-flow-completion.sh ] && . ~/.git-flow-completion.sh
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://github.com/nvie/gitflow.git % sudo make prefix=/opt/local install
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.