Setting up git with Rescuetime highlights

Sun 15 February 2015


Recently I've written on another site how I use Rescuetime to provide metrics on my overall productivity that I can review each week. One useful feature I noticed was Rescuetime highlights, which gives you a good overview of your accompishments throughout the day. The first thing I wanted to add to this (obviously) was git commits.

Luckily it turns out someone had already thought of this and implemented it. The script itself is here, I'm just going to reproduce it below.

# An example hook script to log commit messages
# as a 'daily highlight' in RescueTime Premium
# See for more information
# To enable this hook:
# 1. Place this file in .git/hooks and rename to "post-commit".
# 2. Update the value of API_KEY below with a valid RescueTime API key.
#    [ you can generate a key at ]


# REQUIRED FIELDS - Today's date and commit message

MESSAGE=$(git log -1 HEAD --pretty=format:%s)
DATE_TODAY=$(date +"%Y-%m-%d")

# You can edit the LABEL value if you would rather
# describe these commits differently.

LABEL='Code Commit'

# See more filtering examples in

if [[ ${#MESSAGE} -gt 16 ]]; then
  curl --data "key=$API_KEY&highlight_date=$DATE_TODAY&description=$MESSAGE&source=$LABEL"

Now, the annoying part for me is that this doesn't work globally across all of my git repos, so to fix this you can leverage git's templates directory. To create/initialise a git template folder simply run these commands.

git config --global init.templatedir '~/.git_template'
mkdir -p ~/.git-templates/hooks

Then put the above shell code into ~/.git-templates/hooks/post-commit

What this means is that from now on, any new git repos you initialise will contain this post-hook script. However, if you want to attach this to existing repos, just run a git init wherever the .git folder is.

Category: Productivity Tagged: git Productivity


Engineers Log

Sun 15 June 2014


Four years ago(to the day) I wrote a post on why I was Giving up on wikis and I have to admit, four years later my opinions on the topic really haven't changed.

It's been 4 years, 700 questions(with 800 answers) and  several server moves later and by …

Category: Productivity Tagged: osqa wiki


Read More

Just Keep Going

Tue 19 April 2011

Productivity has never been my strong point. I'm the ultimate procrastinator. I will literally do anything other than the task at hand. In fact this post is likely being written purely as I don't want to study. But, the post itself is useful in it's function to push me forward …

Category: Productivity Tagged: goals


Read More

Music at work

Thu 13 January 2011

For anyone bored of trying to decide what to listen to at work I’d recommend indie 103.1. Decent music and as it’s in La it’s 8 hours behind, so no annoying presenters during the work day(If you’re in the timezone of course).

Anyway, for …

Category: Productivity Tagged: work


Read More
Page 1 of 1