Skip to content

Instantly share code, notes, and snippets.

@HaykoKoryun
Created May 4, 2015 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HaykoKoryun/e987e847e2f69e311162 to your computer and use it in GitHub Desktop.
Save HaykoKoryun/e987e847e2f69e311162 to your computer and use it in GitHub Desktop.
snitch
#!/bin/bash
# change the following two params,
# set up a cron job and there you go!
email="bob@mail.com"
site="your site"
cd "$(dirname "$0")"
if [ ! -f snitch.log ]; then
touch snitch.log
fi
# if git diff finds a difference between
# HEAD and what we have now, snitch!
if [[ -n $(git diff --name-only HEAD) ]]; then
git diff --name-only HEAD > snitchtemp.log
if [[ -n $(diff snitch.log snitchtemp.log) ]]; then
git diff --name-only HEAD > snitch.log
cat snitch.log | mail -s "snitch@$site" "$email"
fi
else
echo "OK"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment