Skip to content

Instantly share code, notes, and snippets.

@aantix
Created January 11, 2011 22:21
Show Gist options
  • Save aantix/775277 to your computer and use it in GitHub Desktop.
Save aantix/775277 to your computer and use it in GitHub Desktop.
Checks to see if there are any uncommitted files and alerts the git user that they need to add or ignore before proceeding.
#!/bin/sh
#
# .git/hooks/pre-commit
#
if git status -u | grep '^# Untracked files:$'
then
echo 'Files need to be either added ( git add .) or ignored (edit the .gitignore file) before a commit can be made.'
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment