git hooks
Check out the sample hooks:
1cd $GIT_REPO
2ls .git/hooks
3head .git/hooks/pre-commit.sample
Add a hook to check the shell scripts in $GIT_REPO
before making a commit:
1echo '#!/bin/sh
2shellcheck *.sh' > .git/hooks/commit-msg
3chmod u+x .git/hooks/commit-msg
Committing
Your git hooks
will not enter the repository, but you can commit them to a repository, then request others add these git hooks to their own branch, by putting a note in the project's README.md
.
1The project comes with recommended git hooks.
2You can activate the hooks with `git config core.hooksPath hooks`.