Git remote/shared pre-commit hook

后端 未结 6 1401
失恋的感觉
失恋的感觉 2020-11-28 06:42

With a one official repository as the remote, and multiple local repositories cloned from it, can a pre-commit hook be scripted on that main repository and be enforced on al

6条回答
  •  日久生厌
    2020-11-28 07:32

    can a pre-commit hook be scripted on that main repository and be enforced on all clones of it?

    From githooks(5):

        pre-commit
          This hook is invoked by git commit, and can be bypassed with
          --no-verify option.
    

    Since the hook can easily be bypassed, it seems the answer to your question is "no".

    Also, since the .git/hooks directory is not cloned, there does not seem to be a mechanism to push it to the client.

提交回复
热议问题