Sometimes you want to run an automated "git commit -a" (perhaps as a cron job), but you don't want to clog up your history if nothing has changed. I use the following script to run a commit only if changes have been made.
#!/bin/bash
#cd /path/to/your/git/repo/
if [ "$(git status -s)" ] ; then
echo "Changes detected. Commiting."
git add .
git commit -am "Data time and who..."
else
echo "No changes detected. Commit canceled."
fi