Skip to content

Instantly share code, notes, and snippets.

@incebellipipo
Last active February 15, 2018 08:20
Show Gist options
  • Save incebellipipo/1e4ab2ecec32b4a180b0a1c6497df5db to your computer and use it in GitHub Desktop.
Save incebellipipo/1e4ab2ecec32b4a180b0a1c6497df5db to your computer and use it in GitHub Desktop.
Git status wtih recursive depth search directory
#!/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