开发者

Can I had git hook files to the repository so everybody has them

开发者 https://www.devze.com 2023-03-20 02:25 出处:网络
I have a git hook file .git/hooks/commit-msg that I would like everybody on the team to have. Can I add it to the reposity 开发者_开发技巧somehow?I think you can\'t directly add the hook to the repo

I have a git hook file

.git/hooks/commit-msg

that I would like everybody on the team to have. Can I add it to the reposity 开发者_开发技巧somehow?


I think you can't directly add the hook to the repository. However you can put the script in the normal tree structure and create a small script to link it to the hooks directory. If you have your commit-msg-hook-script is at the root of your repository, you could create an install_commit_hook.sh, with something like this:

ln -s ../../commit-msg-hook-script .git/hooks/commit-msg
0

精彩评论

暂无评论...
验证码 换一张
取 消