#!/bin/bash cd /path/to/your/git/repo/ if [ "$(git status -s)" ] ; then echo "Changes detected. Commiting." git add . git commit -am "Your explanation here" else echo "No changes detected. Commit canceled." fi