I spend some of my time reviewing team members commits. Typically I’d use the RSS feed from Google Reader, but it doesn’t have the actual diff to comment on.
Most of the time I use tig to view
the commits. And instinctively I’d want to email the author with my comments, so here’s how to do that. I’m sure there are easier commands but this is what worked for me, your experience may vary.
[alias] ... prepmail = !sh -c 'git show $1 > /tmp/commit && mutt -s \"`git show --pretty=format:\"%s\" $1 | head -n 1`\" -i /tmp/commit -- \"`git show --pretty=format:\"%ae\" $1 | head -n 1`\"' -
Now I want to be able to press a key in tig at the diff screen to reply to the author’s commit.
Simply bind a key, in my case I bound s in the diff view to call git prepmail with the commit’s SHA1.
bind diff s !git prepmail %(commit)
Now in the diff view press ‘s’ and tig will launch mutt with the appropriate information.
The email shows up first:
So a simple git alias in $HOME/.gitconfig, a key binding for $HOME/.tigrc, and you can now review commits using tig. Enjoy!