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


SugarCRM - Versioning Your Database

Wed 16 July 2014

One issue that constantly re-occurs for me using SugarCRM is that certain knowledge is only stored in it's database. So say you want to revert to a previous version of Sugar and wish to obtain the Studio customisations you've done at that version, say two days ago, well your just …

Category: SugarCRM Tagged: git sugarcrm php


Read More

Simple git web interface

Sat 07 January 2012

I decided instead of springing for a monthly github payed account I'd install git on a server and use a decent web interface that could be easily installed.

So for this little guide I'm rocking ubuntu 10.04 with git and lighttpd already installed.

It was a Goldilocks search for …

Category: Devops Tagged: git


Read More
Page 1 of 1