tags:

views:

33

answers:

2

git log has a nice --format option to specify how the output should be formatted.

But git blame doesn't seem to have an equivalent, although default output of blame is not quite human-friendly. I would like to see much less.

For example, instead of:

5600cab7 js/sidebar/VehicleGrid.js        (Rene Saarsoo    2009-10-08 18:55:24 +0000 127)    if (x > y) {
b5f1040c js/map/monitoring/VehicleGrid.js (Mihkel Muhkel   2010-05-31 07:20:13 +0000 128)        return x;

I would like to have:

5600cab7 Rene Saarsoo (1 year ago)     127:    if (x > y) {
b5f1040c Mihkel Muhkel (5 months ago)  128:        return x;

I figure that I could write a script to parse the output of git blame --porcelain but given the horrendous default output of blame I feel that somebody out there must have already done something about it.

Any ideas? Or any tips for implementing such a script?

Edit: Solved it by writing small script.

+2  A: 

Considering web interface like Trac or Redmine integrate git blame results, I suppose such a parsing has already been done.

You can see in this Redmine Defect 3832 an example with this ruby script:

VonC
Thanks, this source actually helps.
Rene Saarsoo
**gitweb** also include 'blame' (and 'blame_incremental') view, though it is by default turned off (because it is CPU hog).
Jakub Narębski
+2  A: 

You can use alternate output format: git annotate or git blame -c.

You can change formatting of dates with --date=<format> option (or blame.date config variable), where <format> is one of relative, local, default, iso, rfc, short. See git-blame and git-log manpages for details.

Jakub Narębski
Yeah, the --date option helps a bit, but it's still not nearly as good as I would like it to be. And annotate produces IMHO just an alternative ugly output :P
Rene Saarsoo