看来如果我core.hooksPath在全局配置文件中设置~/.gitconfig,里面的钩子$GIT_DIR/hooks将不会被执行。
我们可以在这两个文件夹中同时运行钩子吗?
不,您需要选择其中之一,或者都不选择。这些文件夹可能具有同名的挂钩。如果两者都生效,应该调用哪一个?
core.hooksPath在您的情况下,默认情况下,将调用全局定义的挂钩。
要调用 中的那些$GIT_DIR/hooks,
# for permanent
# the local config has higher precedence than the global config
git config core.hooksPath $(git rev-parse --absolute-git-dir)/hooks
git some_command
# for once
git -c core.hooksPath=.git/hooks some_command
Run Code Online (Sandbox Code Playgroud)
两者都不调用,
# for permanent
git config core.hooksPath <some_path_without_hooks>
git some_command
# for once
git -c core.hooksPath=<some_path_without_hooks> some_command
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1671 次 |
| 最近记录: |