Проверьте статус GIT
git status [<options>…] [--] [<pathspec>…]
ayaan
git status [<options>…] [--] [<pathspec>…]
if [[ -z $(git status -s) ]]
then
echo "tree is clean"
else
echo "tree is dirty, please commit changes before running this"
exit
fi
//to check how many files contains changes
git status