简体   繁体   English

如何在预提交 git 挂钩中获取“不验证”参数

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

I am developing some code quality checks using git pre commit hook.我正在使用 git 预提交挂钩开发一些代码质量检查。 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我的想法是,如果有人跳过带有此不验证标志的质量检查,我会发送通知电子邮件。我不想限制用户在提交时使用此标志。在预提交挂钩脚本中,我想阅读不-验证 git 提交的参数并根据它的存在,我想发送电子邮件。我正在使用 VS2017,GIT,Azure Devops

Thanks in advance提前致谢

This is not possible. 这是不可能的。 Using the --no-verify argument with git commit means that the pre-commit hook won't be executed at all. git commit使用--no-verify参数意味着pre-commit钩子将根本不会执行。

As per the docs (the githooks manpage): 根据文档( githooks页):

This hook is invoked by git commit, and can be bypassed with the --no-verify option. 该钩子由git commit调用,可以使用--no-verify选项绕过。

You can skip a specific hook too, like this:您也可以跳过特定的钩子,如下所示:

SKIP=flake8 git commit -m "foo"

Documentation link: https://pre-commit.com/#temporarily-disabling-hooks文档链接: https://pre-commit.com/#temporarily-disabling-hooks

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM