Created
March 6, 2015 20:20
-
-
Save renanivo/4f5069fac7300503a783 to your computer and use it in GitHub Desktop.
Pre-commit script to avoid an empty commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LIST_MODIFIED=$(git diff-index --name-status --cached HEAD | grep -w '^.*$' | sed 's/^.\{2\}//') | |
if [ ${#LIST_MODIFIED[@]} -eq 0 ]; then | |
echo "\033[33mNothing to commit, genius!\033[39m""]]" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment