Are git hooks pushed to the remote when I 'git push'?

后端 未结 3 838
花落未央
花落未央 2020-12-07 21:32

If I create a new hook script in my local repository in repo/.git/hooks/post-commit and then I run \"git push\" are the hooks pushed to the remote? Then, when the other dev

3条回答
  •  抹茶落季
    2020-12-07 22:06

    No, git hooks are not pushed or pulled, as they are not part of the repository code.

    Please refer to the documentation for a list of simple client-side and server-side hooks.

    If you want to enable some hooks for all clients that clone or pull from a given repository, you have to add the hooks to your codebase and then create your own script to copy them into, or link to them from repo/.git/hooks/.

提交回复
热议问题