Skip to content

Instantly share code, notes, and snippets.

@brianyoungblood
Created August 9, 2015 22:11
Show Gist options
  • Save brianyoungblood/71dc14383b64337e8f97 to your computer and use it in GitHub Desktop.
Save brianyoungblood/71dc14383b64337e8f97 to your computer and use it in GitHub Desktop.
Log commit messages as a 'highlight' in RescueTime Premium
#!/bin/sh
#
# Log commit messages as a 'highlight' in RescueTime Premium
#
# To enable this hook:
#
# 1. Place this file in your project's .git/hooks directory and make sure its name is "post-commit".
# 2. Make sure it has executable permissions (chmod +x post-commit)
# 3. All commits will be automatically logged as highlight events.
#
API_KEY=asdf12345
# REQUIRED FIELDS - Today's date and commit message
MESSAGE=$(git log -1 HEAD --pretty=format:%s)
DATE_TODAY=$(date +"%Y-%m-%d")
# OPTIONAL - Label
LABEL='code commit'
if [[ ${#MESSAGE} -gt 20 ]]; then
curl --data "key=$API_KEY&highlight_date=$DATE_TODAY&description=$MESSAGE&source=$LABEL" https://www.rescuetime.com/anapi/highlights_post
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment