Skip to content

Instantly share code, notes, and snippets.

@nickwynja
Created January 30, 2014 18:04
Show Gist options
  • Save nickwynja/8714812 to your computer and use it in GitHub Desktop.
Save nickwynja/8714812 to your computer and use it in GitHub Desktop.
Hazel: Check for git changes
# Update the index
git update-index -q --ignore-submodules --refresh
err=0
# Disallow unstaged changes in the working tree
if ! git diff-files --quiet --ignore-submodules --
then
err=1
fi
# Disallow uncommitted changes in the index
if ! git diff-index --cached --quiet HEAD --ignore-submodules --
then
err=1
fi
if [ $err = 1 ]
then
exit 0
elif [ $err = 0]
then
exit 1;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment