phuu is Tom Ashworth

A git workflow

05 Nov 2012

This post is about how I personally work with git. There are a actually a million different possible git workflows, and I’d recommend playing with a few till you find something you like.

My workflow is very similar to, and is based on, Scott Chacon’s Github Workflow. Obviously it works well with github, so collaboration with others is easy, but it’s also designed for a tight feedback-loop using many, cheap, branches and merging often.

Workflow

Here’s the general idea:

Naming

The branch naming convention is helpful for others to understand what you’re working on, and helps you keep organised. A branch called fix/cats-in-profile-pictures is very different to feature/cats-in-profile-pictures. If you know you’ve got to do something, but it’s not new, use task/, and if you’re just trying something out, use try/.

Other thoughts

Branches are cheap. In SVN, branching and merging is painful and so is avoided, but in git it’s trivial. Use them often and throw them away often. A try/ branch can easily become a feature/ branch.

Git is as useful for personal projects as it is for collaboration: using git from the start on your own stuff (even if it’s never meant for the light of day) makes it easy for others to collaborate down the line.

I hope this helps you figure out the right git workflow for you – let me know if you have any ideas or suggestions.