[英]How to update global git hooks for the repo?
When I update global git hooks, and make git init
in repo hooks don't get updated.当我更新全局 git 钩子,并使 repo 钩子中的git init
不会更新。 How to update them?如何更新它们?
你需要运行:
git config --global init.templatedir 'hooks_location'
根据文档,repo 中的后续 init 仅从模板目录添加新文件,但不更新现有文件。
When you do the first git init
from your local repo, the git
will copy the global hooks into the .git/hooks
directory of the git repo you are working only if it's not there .当您从本地存储库执行第一个git init
,只有当它不存在时, git
才会将全局钩子复制到您正在工作的 git 存储库的.git/hooks
目录中。
Solution is, delete the hook from .git/hooks
directory of your local repository.解决方案是,从本地存储库的.git/hooks
目录中删除钩子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.