Minority Opinions

Not everyone can be mainstream, after all.

Git Velocity

leave a comment »

After playing around with the number of lines in my recent git commits, I’ve found something that makes my work look roughly linear.  The key is to take the logarithm of the number of lines per commit, before adding them together.  That changes the graph from a completely useless set of stairs:

To a much more gradual slope:

Vacations and slow times are highly visible against a background of steady progress with occasional spurts.  The huge cliffs are now well integrated into slopes of a few commits each; yes, the graph is a bit steeper in those areas, but it’s not clearly dominated by a small set of points.

In this particular case, the value added to the total by each commit is ROUND(LN(LINES+2)*10), where LINES is the number of lines added or changed.  The 2 is necessary for zero-line commits, since zero itself is undefined for logarithms.  It could be 1, causing such commits to contribute nothing at all, but I like the extra punch that the second fake line gives you.  The rounding is simply to yield integers, in case I want to store the results in a text file sometime, and the 10 is a convenient scaling factor to avoid nasty truncations at lower line counts.

The trend line shows a velocity of just over 80 points a day, or 112 points per weekday.  Those points are more or less meaningless as indications of work, but at least say that I’ve been doing something.  To make my quota for a single day would take 16 zero-line commits, 8 two-liners, 4 commits of 14 lines each, 2 of 256 lines, or a single commit of almost seventy thousand lines.  The three huge ones above top out at 104 points each.

That these counts encourage smaller commits is probably a good thing.  Small changes are easy to verify, and make it easier to see the purpose for a given line.  Massive commits are more likely to have unintended consequences, particularly when they’re caused by accidentally committing everything at once, instead of just the piece you were most recently working on.

It’s still possible to game the system, of course, by running through loads of nearly meaningless changes, or even by breaking up one logical changeset into single lines, because it counts only quantity, not quality.  It’s probably best that you leave it for personal use.  On the other hand, if Github or someone wanted to pick it up as an alternative metric, I would not be opposed.

Advertisements

Written by eswald

17 Jan 2012 at 2:54 pm

Posted in Technology

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s