By Vincent Driessen
on Tuesday, January 26, 2010

After the overwhelming attention and feedback on the Git branching model post, a general consensus was that this workflow would benefit from some form of proper scriptability. The workflow works seamlessly if you perform the steps involved manually, but hey… manually is manually, really.

UPDATE 2/4/2010: I recommend NOT USING this very early release, but to jump on the current develop tip, which is much more mature. Release 0.2 is coming very soon.

An assisting tool (dubbed gitflow) was therefore created to provide simple, high-level commands to adopt the workflow into your own software development process. It’s free and it’s open source. Feel free to contribute to it if you like.

Fork me on Github: http://github.com/nvie/gitflow

Since this morning, the first working release 0.1 was tagged, albeit very basic.

A quick walkthrough

The gitflow script essentially features six subcommands: paired start/finish commands for managing the different types of branches from the originating article:

  • Feature branches:
  • gitflow start feature <myfeature>
  • gitflow finish feature <myfeature>
  • Release branches:
  • gitflow start release <version-id>
  • gitflow finish release@ <version-id>
  • Hotfix branches:
  • gitflow start hotfix <version-id>
  • gitflow finish hotfix <version-id>

Each of these scripts exactly reports what actions were taken and what follow-up actions are required by the user. This output will be polished in future versions to improve the UX . An example output:

$ gitflow finish feature foo
Branches 'develop' and 'origin/develop' have diverged.
And local branch 'develop' is ahead of 'origin/develop'.
Switched to branch "develop"
Your branch is ahead of 'origin/develop' by 12 commits.
Merge made by recursive.
 README |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Deleted branch foo (cd3effb).

Summary of actions:
- The feature branch 'foo' was merged into 'develop'
- Feature branch 'foo' has been removed
- You are now on branch 'develop'

Limitations

The script is very limited at the moment yet, but future versions will fix that, too. Some of the main limitations:

  • Branch names (master, develop) and the remote repo name (origin) are currently fixed.
  • There is no support for dealing with merge conflicts yet.
  • There is no support for support-* branches.
  • There is no documentation.
  • There is no installer.

However, as this post is written, some of the limitations are already taken care of by community members. Power to the open source!

If you want to get in touch, I'm @nvie on Twitter.