Autohook is a very, very small Git hook "framework".
It consists of one Bash script which acts as the entry point for all the hooks, and which runs scripts based on file names.
Let's say you have a cleanup script you want run before commits, aka as a pre-commit
hook. Here's what you could do:
- In your repo, put
autohook.sh
insidehooks/
. - Name the script you actually want to run something like
pre-commit-cleanup.sh
and put it insidehooks/
as well. - Symlink
.git/hooks/pre-commit
tohooks/autohook.sh
. - You're done.
- Rejoice! 🎉
For multiple scripts to be run by the same hook, add them with the hook name at the beginning. You can enforce order with numbers (e.g., pre-commit-1-cleanup.sh
, pre-commit-2-other-stuff.sh
).
For multiple hooks, symlink them to autohook.sh
and name your scripts accordingly.
This software is licensed under the MIT License. Please see the included LICENSE.txt
for details.