I have a git repository with a pre-commit hook set up :
my-repo
|- .git
|- hooks
|- pre-commit # I made this file executable
Until there, everything works. The hook is running when I commit.
=================================
I now run git config core.hooksPath ./git-config/hooks
in my-repo
.
The folder structure is this one :
my-repo
|- .git
|- hooks
|- git-config
|- hooks
|- pre-commit # I made this file executable as well
What happens is :
- the new pre-commit script doesn't run on commit
- the old pre-commit script still runs on commit if I leave it in
my-repo/.git/hooks
- running
git config --get core.hooksPath
inmy-repo
outputs./git-config/hooks
How can I make the new pre-commit hook run on commit ?
Here's the link to the docs I apparently don't understand well :
https://git-scm.com/docs/git-config
https://git-scm.com/docs/githooks
core.hooksPath
myself. Will the default fit hooks be run in addition to you custom hooks or will only your custom hooks be run?core.hooksPath
option overrides the default value (./.git/hooks
) so only the hook scripts in the new folder you specified will be detected and run.