You can use in two ways.
-
Directly as the pre-commit hook in your .git/hooks folder.
-
With Husky by updating your package.json with:
"husky": {
"hooks": {
"pre-commit": "sh ./some-path/pre-commit-prevent-large-files.sh"
}
}
Based on @kiwidamien's original gist here