Search code examples
gitgithookspre-commit-hook

How to get the 'no-verify' argument in pre-commit git hook


I am developing some code quality checks using git pre commit hook. My idea is to send notification emails if some one skips the quality checks with this no-verify flag .I don't want to restrict the user from using this flag on commit .In the pre commit hook script I want to read the no-verify argument of git commit and based on its presence ,I want to send emails.I am using VS2017 ,GIT,Azure Devops

Thanks in advance


Solution

  • This is not possible. Using the --no-verify argument with git commit means that the pre-commit hook won't be executed at all.

    As per the docs (the githooks manpage):

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