public
Created — forked from cowboy/pre-commit

  • Download Gist
pre-commit
Shell
1 2 3 4 5 6 7 8 9 10 11 12
#!/bin/bash
# pre-commit hook to prevent html5 video or audio files from being checked
# into the repo. because large binary files in a git repo sucks. bad.
 
media_files=$(git diff --cached --name-only --diff-filter=ACR | \
egrep -i '\.(webm|mp4|ogg|mp3|ogv|m4v|avi|vp8|mov|oga|mp1|mp2|mpeg|3gp|wav)$')
 
if [[ "$media_files" ]]; then
echo 'Commit failed. Are you trying to check in media files into the repo?'
echo 'ARE YOU A TERRIBLE PERSON?'
exit 1;
fi

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.