git hooks 推送和本地提交
我最近一直在为我的项目团队编写 git hooks。我想知道开发人员是否在本地进行各种提交,而不遵循标准提交消息模式。然后他们推动这些提交。推送会因为提交不遵循模式而失败吗?
期望的结果是他们能够按照自己的意愿在本地进行承诺,然后当他们退回到主要公司分支机构时被迫遵循某种结构方式。
想法?这是最佳实践吗?
I have recently been writing git hooks for my project team. I would like to know if developers are making various commits locally, without following the standard commit message pattern. then they push those commits. Will there push fail because there commits weren't following the pattern?
The desired result would be they are able to commit locally as they wish, then are forced to follow a structure way when they push back to the main corporate branch.
Thoughts? Is this the best practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
诀窍是: git hooks 未发布(推/拉)
因此,如果您的项目成员推送到一个裸存储库,其中服务器端挂钩(
预接收
或更新
)检查提交消息模式(我不确定是否可以完成),该推送将会失败。但是该提交位于开发人员本地存储库中,他/她仍然需要修复它(如果尚未完成其他提交,则
git commit --amend
)。最好是:
请参阅模板目录部分
git init
。这样,它们会比服务器端更快地失败(可以推送n个不正确的提交,并且会失败)。
在其他工作中,这里客户端钩子会更合适。
The trick is: git hooks are not published (pushed/pulled)
So if your project members push to a bare repo where a server-side hook (
pre-receive
orupdate
) check for the commit message pattern (which I am not sure it can be done), that push will fail.But the commit lives on the developer local repo and he/she still has to fix it (
git commit --amend
if no other commits have already been done).It would be better to:
See template directory section of
git init
.That way, they will fail quicker than on the server side (where n incorrect commits can be pushed, and will fail)
In other work, here a client-side hook would be more appropriate.