Summarize commits for the day

Mon 01 November 2010 by Thejaswi Puthraya

Managers will always be managers! Despite having the coolest project management tool (PMT), (D)VCS and what not, they generally request you to send a daily status. You are surprised by this request, especially when an auto generated email is sent for 'every' commit you make, items struck off the todo list and clarifications sought on tickets.

I have been in this situation quite a few times before and usually feel their request is 'irrational' and 'redundant'. A manager is generally overwhelmed by the number of emails sent from a small yet active team. So their request is actually 'justified'. Why do so many PMTs (quite a few of them obscenely expensive) not generate and send a daily summary and alleviate the manager's (and also the team members') pain?

Here's a small one-liner bash script that I've used for generating a summary of the work I have done for the day. It builds a summary based on the git commit messages for the code pushed that day. The most important thing to remember is to write good commit messages (not like these) so that the summary is coherent.

git log --date=iso --author='<author_name>' \
    --since=`date --date='today' +%Y-%m-%d` \
    --until=`date --date='tomorrow' +%Y-%m-%d` \
    --summary --show-notes --oneline --date-order

Reference it as an alias by adding to gitconfig.

# In .git/config
   summarize = !git log --date=iso --author='<author_name>' \
     --since=`date --date='today' +%Y-%m-%d` \
     --until=`date --date='tomorrow' +%Y-%m-%d` \
     --summary --show-notes --oneline --date-order
$ git summarize
5e5605c Homepage logo size has been reduced to align the divs correctly.
94ea527 Added the new community page. Requires layout changes and images.
c58411d First iteration of the new community page.
06ed1f1 Removed alert boxes and replaced with overlays.
a3115e8 The overlay works but other smaller issues to fix.

For mercurial users,

hg log --user='<author_name>' --date="`date --date='today' +%Y-%m-%d`" --template "{node|short}\t{desc}\n"

I don't think it's possible to run shell commands in mercurial aliases, so you've to create a shell alias in either .bashrc or .bash_aliases

alias summarize="hg log --user='<author_name>' --date=\"`date --date='today' +%Y-%m-%d`\" --template \"{node|short}\t{desc}\n\""

$ summarize
2ca037d7d7e0        Merging the dev and stable branch
66faaf77da63        Added pyc* pattern to the .hgignore file
b1de7610277d        Removed sitemedia images totally from being added to the repo
c6d6838a2ac2        Prevent the top.jpg from getting added to the repo by adding in .hgignore
473dcbab500d        Removed a hardcoding in the web/ file