Git:post-receive电子邮件挂钩,包括diff补丁? [英] Git: post-receive email hook, including diff patches?

查看:91
本文介绍了Git:post-receive电子邮件挂钩,包括diff补丁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google使用电子邮件发送所有提交给远程/共享库的Google搜索后,我找到了Git的post-receive钩子。



这个问题与 post-receive hook 是它只能提供谁提交了提交,日志消息,日期,文件)受到影响。我也希望在电子邮件中看到受影响的文件生成的补丁,以查看对代码进行了哪些更改。 Subversion很好地完成了这项工作。



有没有人有一个解决方案,可能是一个env变量,可能会传递给post-receive钩子?或甚至更好,一个已经煮熟的例子?



感谢所有!

解决方案

div>

最近的Git版本应该安装一个 post-receive-email 脚本。其中说:


hooks.showrev

使用的shell命令在电子邮件中格式化每个修订版,并将
%s替换为提交ID。默认为git rev-list -1
--pretty%s,显示提交ID,作者,日期和日志
消息。要列出由空白行分隔的完整补丁,您可以将
设置为git show -C%s; echo。

因此,只需将 hooks.showrev 设置为git show -C%s;回声在存储库与电子邮件挂钩,你都设置。


I found a post-receive hook for Git after some googling that I use to e-mail all commits to a remote/shared repo.

The problem with this post-receive hook is that it only has the capability to provide who made the commit, the log message, date, file(s) affected. I also want to see the affected file(s) generated patches in the e-mail to see what changes were made to the code. Subversion does this rather nicely.

Does anyone have a solution for perhaps an env-variable that may be passed to the post-receive hook that does this? Or even better, an example that is already cooked up?

Thanks all!

解决方案

Recent Git version should install a post-receive-email script. In it, it says:

hooks.showrev

The shell command used to format each revision in the email, with "%s" replaced with the commit id. Defaults to "git rev-list -1 --pretty %s", displaying the commit id, author, date and log message. To list full patches separated by a blank line, you could set this to "git show -C %s; echo".

So just set hooks.showrev to "git show -C %s; echo" in the repository with the email hook and you’re all set.

这篇关于Git:post-receive电子邮件挂钩,包括diff补丁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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