ambevar-dotfiles/.scripts/git-check

24 lines
442 B
Bash
Executable File

#!/bin/sh
usage () {
cat <<EOF>&2
Usage: ${0##*/} FOLDERS
Chack all git repos found in FOLDERS for non-commited file.
EOF
}
[ $# -eq 0 ] && usage && exit 1
[ "$1" = "-h" ] && usage && exit
[ "$1" = "--" ] && shift
for i; do
while IFS= read -r FOLDER; do
if [ -z "$(cd -- "${FOLDER%/*}" && LC_ALL=C git status -uno | grep "nothing to commit")" ]; then
echo "${FOLDER%/*}"
fi
done <<EOF
$(find "$i" -type d -name ".git")
EOF
done