Matt Kirman

My Git Workflow; Introducing Flit

I’ve been a Git convert, and version control geek, for over a year now so I’ve sort of become the unofficial Git consultant at the office. If anythings breaks or something weird happens I’m usually the one called in to sort it out.

In order to preserve at least some of the remnants of our sanity I decided, after my colleague managed to corrupt his entire local repository, that I needed to enforce some sort of system. What I finished up with is this fairly typical workflow:

Once our code is ready for staging we push our code to the staging branch, and likewise to the production branch. The master branch is reserved for bleeding edge code.

I then started thinking, surely there must be a much easier way to manage this workflow? A minimum of seven separate commands to merge my changes into master and push it back to the server?

Introducing Flit

Flit is a command line utility that eases the typical Git workflow that I’ve outlined above. Setting up Flit to work with either a new or existing Git repository is a simple as flit init. If you haven’t already created a Git repository then Flit will create one for you.

Then, whenever you want to start, or continue with, a feature or bugfix simply do flit start feature my_new_feature. Flit will create, or switch, to your feature branch, ready for you to start hacking away.

You can then use Git as normal, committing your changes as and when you see fit. Once you’ve finished work for the day on your feature or bugfix, flit stop will return you back to your development branch.

Once your feature is complete flit finish feature my_new_feature will pull down changes in master, rebase them into your feature branch and then merge your feature back into master.

Caveats

Flit is an extremely early alpha. Features may be broken or just plain missing, but getting this code out into the open-source community where people can start hacking away with it is much more important.

To that end, the entire codebase is hosted on GitHub. If something’s missing just fork the code, add your fix and send me a pull request.

Requirements

Installation

The easiest way to install Flit is through RubyGems: gem install flit --pre
Alternatively you can install Flit from source: rake gem && rake install

Comments