Skip to content

Instantly share code, notes, and snippets.

@kutyel
Last active August 4, 2016 12:18
Show Gist options
  • Save kutyel/2ae3bb4a67a78c742520120e451e0c1f to your computer and use it in GitHub Desktop.
Save kutyel/2ae3bb4a67a78c742520120e451e0c1f to your computer and use it in GitHub Desktop.
Post commit hook!
#!/bin/sh
#
# by Flavio Corpa
# get last two commits date from git log (in seconds)
arr=($(git log -2 --author="[email protected]" --format=%at))
# convert them to hours (with decimals)
hours=$(awk "BEGIN {printf \"%.2f\",$(((arr[0]-arr[1])/3600))}")
# write them to the output file
echo "($hours h)" >> /p/Trabajo/Geonet_FCR/commits-diarios.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment