Can I had git hook files to the repository so everybody has them
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
精彩评论