Last active
February 15, 2018 08:20
-
-
Save incebellipipo/1e4ab2ecec32b4a180b0a1c6497df5db to your computer and use it in GitHub Desktop.
Git status wtih recursive depth search directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REPOSITORY_DIRS=$(find . -type d -name '.git' | xargs -n 1 dirname) | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
clean=true | |
for repo in $REPOSITORY_DIRS | |
do | |
status=$( git -C $repo status -s ) | |
if ! [ -z "$status" ] ; then | |
clean=false | |
printf "\n" | |
echo "${bold}Change detected repository at: $repo${normal}" | |
git -C $repo status -s | |
fi | |
done | |
if $clean ; then | |
echo "${bold}Working directory is clean${normal}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment