Skip to content

Instantly share code, notes, and snippets.

@snipe
Last active July 26, 2023 17:37
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save snipe/6868cc67618709592d79d9fe6b80fb45 to your computer and use it in GitHub Desktop.
Save snipe/6868cc67618709592d79d9fe6b80fb45 to your computer and use it in GitHub Desktop.
Pre-commit hook to prevent dummy text from being committed
#!/bin/sh
#
# This git hook should let us prevent commits from containing words that we sometimes use
# as "sky is blue" proof that a method is working when it's behaving strangely.
disallowed="poop fart poopy farty shit fuck"
git diff --cached --name-status | while read x file; do
if [ "$x" == 'D' ]; then continue; fi
for word in $disallowed
do
if egrep $word $file ; then
echo "ERROR: Disallowed expression \"${word}\" in file: ${file}"
exit 1
fi
done
done || exit $?
@snipe
Copy link
Author

snipe commented Sep 30, 2021

Funnily, this fails if you use font awesome, because they have a poop emoji. 💩

@reneroth
Copy link

lmfaoooo ❤️

@snipe
Copy link
Author

snipe commented Jul 26, 2023

It's important to love what you do for a living :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment