Show the number of lines which were changed or removed since a given commit, grouped by their former blamee.
Usage: git absolve <commit> [<commit>]
Suppose we want to find out who was absolved between master and my-feature-branch. The algorithm is effectively the following:
- Take the diff between master and my-feature-branch.
- For each line coloured red, run git blame on it.
- Take the person who git blames and add 1 to their score.
For each person, we also show the timestamp of their most recent line.
This is meant to give an indication of whose code it is that my-feature-branch is messing with. Perhaps you should consider CCing the top-scorers when you start the code-review?
Example output (finding out who was absolved between the tag "1.1.0" and HEAD):
$ git absolve 1.1.0 349 2016-10-17 Magnus Edenhill 34 2015-12-22 François Saint-Jacques 1 2015-02-18 Vaclav Krpec
This means that, since 1.1.0, the current branch has removed or modified 349 lines which were last touched by Magnus (the most recent of which he changed on 17th Oct). I suppose he'd make a good reviewer.
This is a partial clone of Tim Pettersen's git-guilt (and it's not even
the first clone). Read about the design and intended use-case of
git-guilt here. Tim's original version is superior to the one found here
in a few ways:
git-guilttracks lines added as well as lines removed. I think this is a more robust algorithm than the one I use. (OTOH, it slows things down and doesn't make much of a difference when the branch you're diff-blaming has only a single author.)
git-guiltdisplays results in a nice diffstatty format which looks better than
git-guilthas lots of options.
Why might you prefer this implementation? The original
git-guilt is 300+
npm. When I tried running it on a branch, it took 1.6s to compute the result.
The python port is 800+ lines long, and took 3s to run on the same branch.
git absolve is 50 lines of sh and awk which takes 0.7s to run on that same branch.
Two other very similar programs are git-related and git-contacts. These seem to have slightly different behaviour from git-guilt and git-absolve, but are clearly intended for the same purpose. They are very slow.