我有一个带有预提交钩子的git存储库:
my-repo
|- .git
|- hooks
|- pre-commit # I made this file executable
Run Code Online (Sandbox Code Playgroud)
一直到那里,一切正常.我提交时挂钩正在运行.
=================================
我现在跑git config core.hooksPath ./git-config/hooks进去了my-repo.
文件夹结构是这样的:
my-repo
|- .git
|- hooks
|- git-config
|- hooks
|- pre-commit # I made this file executable as well
Run Code Online (Sandbox Code Playgroud)
会发生什么:
my-repo/.git/hooksgit config --get core.hooksPath在my-repo输出中运行./git-config/hooks如何在提交时运行新的预提交钩子?
以下是我显然不太了解的文档的链接:
https://git-scm.com/docs/git-config
https://git-scm.com/docs/githooks
tor*_*rek 20
这个core.hooksPath支持是Git 2.9版中的新增功能,已经提交了867ad08a2610526edb5723804723d371136fc643.如果您的Git版本不是至少2.9.0,设置hooks-path变量将完全没有效果.