Skip to content

Instantly share code, notes, and snippets.

@bitdivine
Created June 30, 2016 15:20
Show Gist options
  • Select an option

  • Save bitdivine/7829a5f2aa8865420a2cda1bbe98c07f to your computer and use it in GitHub Desktop.

Select an option

Save bitdivine/7829a5f2aa8865420a2cda1bbe98c07f to your computer and use it in GitHub Desktop.
Check whether git is clean using plumbing methods
if git ls-files -mo --exclude-standard | grep -q .
then
echo ":-X Dirty git. Say sorry:"
read sorry ; [[ "${sorry:-unrepentant}" == "sorry" ]] || exit 1
else echo ":-) Git clean"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment