This repository includes a pre-commit hook to prevent large file commits. The pre-commit hook checks the size of files before allowing a commit to proceed. If a file exceeds the specified limit, the commit will be aborted.
- Git must be installed on your machine.
-
Clone the Repository:
git clone [email protected]:tradingstrategy-ai/trade-executor.git
-
Navigate to the Repository:
cd trade-executor
-
Copy the Pre-commit Hook:
Run script to copy the pre-commit file from this repository to the
.git/hooks/
directory of project and add it to git stagebash scripts/set-pre-commit-checkfilesize.sh
You can customize the behavior of the pre-commit hook by adjusting the MAX_FILE_SIZE variable in the pre-commit script. This variable represents the maximum allowed file size in megabytes.
# Set the maximum allowed file size in megabytes
vim .git/hooks/pre-commit
# Edit MAX_FILE_SIZE
MAX_FILE_SIZE=35
Modify the MAX_FILE_SIZE value according to project requirements.
To test the pre-commit hook, attempt to commit changes to repository. If a file exceeds the specified size limit, the commit will be aborted with an error message indicating the problematic file.
- Double-check the MAX_FILE_SIZE variable in the pre-commit script to ensure it meets your project's requirements.