Skip to content

Instantly share code, notes, and snippets.

@Florent2
Created August 21, 2015 11:55
Show Gist options
  • Save Florent2/8bd36b12016168f2d05f to your computer and use it in GitHub Desktop.
Save Florent2/8bd36b12016168f2d05f to your computer and use it in GitHub Desktop.
Git pre commit to abort commit if there are untracked files in the repository
if [[ -n $(git ls-files --other --exclude-standard) ]];
then
echo "commit aborted, there are untracked files!"
exit 1
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment