参考サイト様
その1
git diff --quiet && git diff --staged --quiet || git commit -am 'XXXX'
その2
git commit -m "XXXX" || echo "No changes to commit"
git diff --quiet && git diff --staged --quiet || git commit -am 'XXXX'
git commit -m "XXXX" || echo "No changes to commit"