If you need to check if a repo has files that need to be committed:
Only modified files:
if [[ $(git diff --stat) != '' ]]; then
echo 'dirty'
else
echo 'clean'
fi
Only new files:
if [[ $(git status --short | grep "??" ) != '' ]]; then
echo 'dirty'
else
echo 'clean'
fi
Either new or modified files:
if [[ $(git status --short) != '' ]]; then
echo 'dirty'
else
echo 'clean'
fi