Git: How to do pre-commit
STEP1: Find .git/hooks
Find the hooks folder in the (hidden) .git configuration folder
1
cd .git/hooks
STEP2: Create
pre-commit
file
1 | touch pre-commit |
STEP3: edit pre-commit
file
1 | vi pre-commit |
and add something like this:
1 | !/bin/bash |
Now whenever you commit, it will automatically clean the subdirectory and will not commit any executable files. Note, if the operating system changes, the script will also need to change.
Git: How to do pre-commit