Example pre-commit hook to prevent submitting large files: {{{ #!/bin/bash maxsize=10 # maximum file size in Mb changedFiles=$(git diff --cached --name-only) err=0 for changedFile in $changedFiles do lfs=`git check-attr filter $changedFile | grep ': filter: lfs' | wc -l` # check if lfs-controlled filesize=`du -b --apparent-size $changedFile | cut -f 1` # check file size if [ "$filesize" -gt "$maxsize" ] && [ "$lfs" -eq "0" ] then if [ "$err" -eq "0" ] then echo "The following files to commit are larger than $maxsize Mb and should use LFS" fi echo " - $changedFile $filesize" err=1 fi done exit $err }}}