git预提交钩绕电子邮件 [英] git pre-commit hook bypass email

查看:178
本文介绍了git预提交钩绕电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个预提交钩子,可以在分段区域中的所有文件上运行PHP Codesniffer。但是,有时开发人员通过向git commit命令添加--no-verify选项来绕过此钩子。有没有办法每次开发人员绕过钩子发送电子邮件?

I have a pre-commit hook that runs PHP Codesniffer on all files in the staging area. However, sometimes developers bypass this hook by adding --no-verify option to the git commit command. 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 ...在DVCS世界中,私人回购中发生的一切都是私人事务。您作为团队存储管理员可以为他们提供一些设施来增强和简化工作,但是您不应该过度运行。

Whooph... In the DVCS world everything that happens in a private repo is a private business. 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.

或者,确实建议任何有价值的项目,您可以设置一个更复杂的代码审查系统(我们的团队使用 gerrit ,但有其中很多包括用PHP编写的)。因此,您的团队成员将熟悉其他成员作品,建议改进等等,而机器人将执行常规任务,例如检查代码风格,运行单元和集成测试等。

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). 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.

这篇关于git预提交钩绕电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆