简体   繁体   English

git pre-commit挂钩绕过电子邮件

[英]git pre-commit hook bypass email

I have a pre-commit hook that runs PHP Codesniffer on all files in the staging area. 我有一个预提交的挂钩,该挂钩在登台区域中的所有文件上运行PHP Codesniffer。 However, sometimes developers bypass this hook by adding --no-verify option to the git commit command. 但是,有时开发人员通过在git commit命令中添加--no-verify选项来绕过此钩子。 Is there a way I can send an email each time a developer bypasses the hook? 每当开发人员绕过钩子时,有没有一种方法可以发送电子邮件?

Too long for a comment, but probably not a complete answer. 评论时间过长,但可能不是完整的答案。

Whooph... In the DVCS world everything that happens in a private repo is a private business. 糟糕...在DVCS世界中,私人回购中发生的一切都是私人企业。 You as a team repository administrator can propose them some facilities to enhance and simplify their job, but you shouldn't overcarry. 作为团队存储库管理员,您可以为他们提供一些设施来增强和简化他们的工作,但是您不应该负担过多。

You, however, can and actually should put some automatic sanity checks on receiving their commits on the team repository side. 但是,您可以并且实际上应该在团队存储库侧对接收到的提交进行自动检查。 Likely pre-receive hook is a better place for obligatory checks. pre-receive钩子可能是进行强制检查的更好位置。

Alternatively, and indeed it's recommended for any "valuable" project, you could set up a more complex system for code review (our team uses gerrit but there're plenty of them including those written in PHP). 另外,实际上,建议将其用于任何“有价值的”项目,您都可以设置一个更复杂的系统来进行代码检查(我们的团队使用gerrit,但其中很多都包括用PHP编写的代码)。 Thus, your team members will familiarize themselves with other members works, suggest improvements and so on, while robots will perform routine tasks, like checking code-style, running unit- and integration tests and so on. 因此,您的团队成员将熟悉其他成员的工作,提出改进建议等,而机器人将执行例行任务,例如检查代码样式,运行单元测试和集成测试等。

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

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