简体   繁体   English

从上一个'git pull'获取差异更改的电子邮件

[英]Get email with the diff changes from the last 'git pull'

I want to get an email that will display the last changes made by git. 我想收到一封电子邮件,其中将显示git所做的最后更改。 It should be nicely formatted similar to github ( + are green, - are red). 它的格式应该与github类似(+是绿色,-是红色)。

This is what I have done so far: 到目前为止,这是我所做的:

  1. Configured Jenkins to check every 5 minutes for changes, pull the changes, and send email. 将Jenkins配置为每5分钟检查一次更改,提取更改并发送电子邮件。
  2. Installed 'Jenkins Email Extension Plugin', configured it to work with a custom 'jelly' template, which send also the console output to the email. 安装了“ Jenkins电子邮件扩展插件”,并将其配置为与自定义的“果冻”模板一起使用,该模板还将控制台输出发送到电子邮件。
  3. I added a script to the build, which run 'git show'. 我向构建中添加了一个脚本,该脚本运行“ git show”。

This way, I get the output of 'git show' to the email every 5 minutes if code is changed within this time. 这样,如果在这段时间内更改了代码,我每隔5分钟就会将“ git show”的输出输出到电子邮件中。

What is missing is as follows: 缺少的内容如下:

  1. If two commits occurred within 5 minutes, it'll show only the diff made by the last one. 如果在5分钟内发生了两次提交,则只会显示最后一次提交的差异。 I guess that's what git show does. 我猜这就是git show所做的。 I need all the changes from the current code, not all changes from last commit. 我需要当前代码的所有更改,而不是最近一次提交的所有更改。
  2. It is not formatted nicely. 格式不正确。 it is just a plain text. 这只是纯文本。

I'd appreciate any help here. 我会很感激这里的任何帮助。 Thanks. 谢谢。

git diff --color @{yesterday} (或者每当完成最后一次拉取/有兴趣的时候)对我来说都很好...

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

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