Last active
March 17, 2020 10:35
-
-
Save ChrisLeNeve/d734cb95e0c6e2a6aa517c440af42764 to your computer and use it in GitHub Desktop.
git pre commit hook - blocking added accents and bad characters
This file contains 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
#!/bin/bash | |
echo "Checking your changes..." | |
#Whatever characters you want here, in the grep | |
if git diff --cached origin/stage *.html | grep -c 'é\|è\|ô' | |
then | |
echo "Impending doom shall be thy fate, o vilainous junior dev! Banish from thy work these monstrosities, or live to see thy kin demolished" | |
exit 1 | |
fi | |
echo "Well; thou hast not added horrid characters to thy code. Thou shalt live to see another day, o valorous developer" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmod +x .git/hooks/pre-commit