This hook warns you before you accidentally commit large files to git. It's very hard to reverse such an accidental commit, so it's better to prevent it in advance.
Since you will likely want this script to run in all your git repos, a script is attached to add this hook to all git repos you create / clone in the future.
Of course, you can just download it directly to the hooks in an existing git repo.
If you find this script useful, you might enjoy our more heavy-duty project FastDS, which aims to make it easier to work with versioning in data science projects.
curl -L https://gist.github.com/guysmoilov/ddb3329e31b001c1e990e08394a08dc4/raw/install.sh | bash
The default limit is max 5MB per file. If you feel that your commit is a special case, you can always override the limit with:
GIT_FILE_SIZE_LIMIT=42000000 git commit -m "This commit is allowed file sizes up to 42MB"
- pre-commit : The hook itself
- install.sh : Installs this hook to your git template directory.
Adapted from: https://gist.github.com/benmccallum/28e4f216d9d72f5965133e6c43aaff6e
i'm getting below error on commit:
.git/hooks/pre-commit: 11: arithmetic expression: expecting primary: " 95000000 / 10**6 "
(I needed a max of 95mb so I only changed that part).
when replacing 10**6 by 10*6 it seems to work, but I'm not fully sure if it had a special meening to have ** as it appears twice like this in your script.