Automate your git workflow

In my previous post I discussed a git workflow for small teams. After repeating that long process for every new feature that needs to be developed, you might find yourself cutting corners and skipping parts of the process (I know I did). Why not take the best of both worlds and have a bulletproof workflow while still being lazy?

Automation with Hack, Squash, and Ship

Repeating that process for every feature can get a little repetitive. Let’s simplify our lives a little. I found inspiration for this method from Rein’s post on Hack && Ship. I have been using a similar method ever since.

First, we’ll create our three scripts.

Hack

This script will pull the latest changes in the development branch and rolls those changes into your current feature branch. Now you never need to leave your feature branch to get your team’s changes!

Squash

This script will take all of your little commits (You are committing early and often to track your progress, aren’t you?) and roll them into something pretty that represent the feature. This gives your team a concise git log to look at.

Ship

One last script to ship out your current finished (and tested!) feature and send it to the upstream development branch. Now your team can enjoy that precious work you just did!

Simplified workflow

Now, the process is simple:

Create a new branch off of development named after the feature.

Work on the feature, continuously committing at regular intervals to keep track of what you’ve done.