Be Present Now

Sometimes witty, sometimes childish. Add gesticulation, shake.

I love staring at branches and shuffle, reorder and squash commits

I don’t know what it is. Maybe it’s inherent to human nature to strive for and to create order. Maybe it’s just me.

But I love staring at branches and I love cleaning up my commit history until it shines. This is of course possible and encouraged with git and it’s only possible if you haven’t shared your code with anyone else publicly (pushed to a shared remote repository).

So how does a shuffling cleaning frenzy look like? Here: (The screen-shot below is from GitX just for eye candy).

Alt text

How do I work? Before I share my work with other developers I commit stuff to local branches furiously and in very small increments, I branch away like crazy. Then after a while I realize things are messy and commits are not elegantly divided per feature. So I stop coding and start cleaning the history of commits until they fit into a clean list of recognizable units of work.

At that point I can merge the work back into the mainline, say the master branch or some shared topic branch. Tools of the trade ? git branch, git reset, git cherry-pick and the very powerful git commit –interactive.

If you’re wondering why I like git and why I don’t use x (where x could be svn, hg, bzr or perforce) a good collection of reasons can be found at Why Git is Better Than X .

16 August 2009

Sign up to receive my next blog posts via email: