Skip to content

Instantly share code, notes, and snippets.

@FuYaoDe
Created December 2, 2015 12:21
Show Gist options
  • Save FuYaoDe/de05cfe2481cd84412ef to your computer and use it in GitHub Desktop.
Save FuYaoDe/de05cfe2481cd84412ef to your computer and use it in GitHub Desktop.
Run Check .only before commit, prevent mocha test prevent .
#!/bin/sh
#
# Run Check Only before commit.
RED='\033[0;31m'
if [ "$(git diff --cached | grep "+" | grep ".only")" != "" ]; then
echo ""
echo "${RED}COMMIT FAILED:"
echo "${RED}Some spec files have .only. Please remove only and try committing again."
exit 1
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment