Skip to content

Instantly share code, notes, and snippets.

@leedo
Created May 2, 2015 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leedo/ecf1b87e30d3a7c064c7 to your computer and use it in GitHub Desktop.
Save leedo/ecf1b87e30d3a7c064c7 to your computer and use it in GitHub Desktop.
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
for dir in $(find "$1" -maxdepth 1 -type d); do
if [ -d "$dir/.git" ]; then
dirty=$(git -C "$dir" diff --shortstat 2> /dev/null | tail -n 1)
if [[ $dirty != "" ]]; then
printf "$RED%s$NC\n" $(basename "$dir")
else
printf "$GREEN%s$NC\n" $(basename "$dir")
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment