Created
June 6, 2017 16:40
-
-
Save jcromartie/26489ecea86338e3a883c83bc6409933 to your computer and use it in GitHub Desktop.
pre-commit hook which fails when untracked files are present in working tree
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/sh | |
untrackedFiles=$(git ls-files --others --exclude-standard) | |
if [ ! -z "$untrackedFiles" ] | |
then | |
echo "There are untracked files in the working tree:" | |
echo "$untrackedFiles" | |
echo "" | |
echo "Are you sure you aren't forgetting something?" | |
echo "Aborting commit..." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment