How to git commit nothing without an error?
Solution 1:
Catch this condition beforehand by checking the exit code of git diff?
For example (in shell):
git add -A
git diff-index --quiet HEAD || git commit -m 'bla'
EDIT: Fixed git diff
command according to Holger's comment.
Solution 2:
From the git commit
man page:
--allow-empty
Usually recording a commit that has the exact same tree as its
sole parent commit is a mistake, and the command prevents you
from making such a commit. This option bypassesthe safety, and
is primarily for use by foreign SCM interface scripts.