Way to have GitHub send commit notifications including the diff

github

Does anyone know of a way to have GitHub email commit/pull request notifications including the full diff of the commit?

I know about the email service hook, but that doesn't send the diff.

Best Answer

At this time, there is no way to do what you want using just GitHub. As noted in https://stackoverflow.com/questions/4211107/how-to-get-email-diffs-for-github-pushes, there is no support within GitHub to send e-mails including diffs. There are two GitHub issues raised asking about this - http://github.com/github/github-services/issues/86 (closed) and http://github.com/github/github-services/issues/149 but although they say this is something they might implement in the future, there is no indication this will happen.

That said, if you are willing to run your own (local or cloud hosted, but with scripting) web or e-mail server with git repository, you could build this yourself using GitHub post-receive notifications (http://help.github.com/articles/post-receive-hooks) sent to your web server, or normal (without diffs) e-mail notifications sent to a special address on your e-mail server. The choice between web and e-mail notification would be made depending on where & how you are hosting your server - if you have good connectivity & reliability, web notifications will have lowest latency, but if your web-server is unreachable for any reason, you won't get a notification until the next commit that is made while your web-server is reachable; using e-mail will delay the whole process, but might be preferable if you are hosting this at home, and especially for any machine that is not always on.

In either case, you would have to write a script that takes the (e-mail or web/JSON) notification and pulls the relevant repo(s) from GitHub to a local repository, where you would have to set up Git's internal post-receive hook mechanism to run something like http://github.com/jtek/git-hook-update-notify-email (mentioned in the above stackoverflow article) or if you're willing & able to install & use Pygments (Python code colorizer) perhaps something nicer looking like http://blog.chomperstomp.com/making-git-show-post-receive-e-mails-as-an-html-color-formatted-diff/ (linked to/from https://stackoverflow.com/questions/3232270/git-post-receive-email-hook-to-show-an-html-formatted-color-diff/).

It's a bit of scripting work, and requires that you have some hosting infrastructure to run the web or e-mail server, the local-pull script, and then the local post-receive hook to generate the actual e-mail with diffs, but it should be possible to set this up in less than a day.