- Clone the repo
- Copy the desired hook file to
.git/hooks
folder of your repo- Make the script executable with
chmod +x [git-hook-file-name]
- Configure as desire
This hook is for execute a command when specific file extension are being modified. f.i. when we're working on
.TS
files and we want to execute the linting after pushing the branch.
git config --add pre-push.[ extension ].command "commands; commands;"
examples:
git config --add pre-push.ts.command "ng build;"
git config --add pre-push.ts.command "ng lint; ng test;"
This hook is for add the issue id part of the current branch into the commit message. f.i. when you are on a branch like
bugfix/APM-123456-test-branch
, this hook will extractbugfix/APM-123456
and add it to the commit msg.