Skip to content

Instantly share code, notes, and snippets.

@shrop
Last active November 17, 2022 08:07
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrop/5995086 to your computer and use it in GitHub Desktop.
Save shrop/5995086 to your computer and use it in GitHub Desktop.
Improved script for highlighting git repo folders which have unstated/uncommitted files. An improvement on the script for the Hazel rule created by @tylerhall: http://clickontyler.com/blog/2013/03/hazel-and-git. This improvement checks to see if the folder is actually a git repo and if not, doesn't bother processing any further.
dirname=$1
if [ -f $dirname ]; then
dirname=`dirname $dirname`
fi
cd $dirname
if [ ! -d .git ]; then
exit 1
fi
if git status | grep --quiet "working directory clean"; then
exit 1
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment