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.

  • You might want to chime in on github.com/github/github-services/issues/149 - the service hooks don't even get the diff
    – Alex Dupuy
    Jan 13, 2012 at 10:09
  • Don't hold your breath, though, github.com/github/github-services/issues/86 was closed in April, so it seems unlikely they will do anything with issue 149 either.
    – Alex Dupuy
    Jan 13, 2012 at 10:13
  • This question was answered (in the negative, mostly) at stackoverflow.com/questions/4211107/…
    – Alex Dupuy
    Jan 13, 2012 at 10:14
  • @Alex - Would you like to post your comment as an answer to help move this question off the front page of unanswered questions? Jun 14, 2012 at 1:40
  • @ShannonWagner - so posted. I even came up with a way to make it all happen, using local resources and other tools, but the instructions are only a rough outline, and making it happen would require scripting, assembly and batteries not included.
    – Alex Dupuy
    Jun 15, 2012 at 14:33

2 Answers 2


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.


It's possible generate git diff on each push and send it via email using Github Actions. Here is the example

    - name: Generate git diff since last push
      run: |
        # write raw git diff in file
        git diff ${{ github.event.before }} ${{ github.sha }} > git.diff
        # convert raw git diff to html
        git diff ${{ github.event.before }} ${{ github.sha }} | bash ./.github/diff2html.sh > email-body.html
        zip -r diff.zip git.diff email-body.html
    - name: Send git diff mail
      uses: dawidd6/action-send-mail@v2
        server_address: email-smtp.us-east-1.amazonaws.com
        server_port: 465
        username: ${{secrets.MAIL_USERNAME}}
        password: ${{secrets.MAIL_PASSWORD}}
        subject: Github Actions job result
        # Read file contents as body:
        body: file://email-body.html
        to: [email protected]
        from: Luke Skywalker <[email protected]>
        # Optional content type (defaults to text/plain):
        content_type: text/html
        attachments: diff.zip

Converted git diff to HTML page is stored here https://github.com/sturman/git-diff-email/blob/master/email-body-example.html

The full project is stored here https://github.com/sturman/git-diff-email/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.