Open MarcSerraPeralta opened 3 months ago
This ref has a nice description of local and server git hooks.
From this stackoverflow post, it seems that a better way to store the git hooks in a repo is:
Nowadays you can do the following to set a directory that is under version control to be your Git hooks directory, e.g., MY_REPO_DIR/.githooks would be
git config --local core.hooksPath .githooks/
It is still not directly enforceable but, if you add a note in your README (or whatever), this requires a minimum of effort on each developer's part.
One of the drawback that I see is if one needs to rapidly merge a hotfix, because maybe it does not fulfill pass the git hook (e.g. imagine that the pre-push
runs the tests locally). However, this could be solved by checking if the name of the branch starts with hotfix
...
It could be interesting to understand the usefulness of git hooks:
from https://git-scm.com/docs/githooks
This was brought to my attention when watching this Youtube video (at 4:11min)