2

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?

bradgonesurfing
  • 30,949
  • 17
  • 114
  • 217
  • possible duplicate of [Can Git hook scripts be managed along with the repository?](http://stackoverflow.com/questions/427207/can-git-hook-scripts-be-managed-along-with-the-repository) – manojlds Jul 14 '11 at 14:09
  • Another strongly-related question: [Putting Git hooks into repository](http://stackoverflow.com/questions/3462955/putting-git-hooks-into-repository/3464399#3464399) – Cascabel Jul 15 '11 at 00:53

1 Answers1

5

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
Michaël Witrant
  • 7,525
  • 40
  • 44