How to get email diffs for GitHub pushes?

Has anyone come up with a good way to get emails when commits are pushed to your GitHub repo — that includes a diff of files changed?

(I know they have an Email Service Hook – but that doesn’t include a diff)

  • Use Xcode 4 as Git difftool
  • git diff - handling long lines?
  • git smart line and word diff
  • Show non-merge differences for two commits in git
  • Is it possible to use the “minimal” algorithm for interactive adding?
  • Git Diff between HEAD and SVN Master
  • Mega bonus points if the diffs are colorized with inline CSS that’s viewable in Gmail.

  • GIT - how to keep a file common across all branches
  • Is git commit -am redundant, if I do git add before?
  • Git remote operations inside Visual Studio 2013 result in the error “A specified logon session does not exist. It may already have been terminated”
  • How do I get TeamCity to create the .git directory when cloning a repo for build?
  • Splitting many subdirectories into a new, separate Git repository
  • Can we use :podspec link with dependencies in a podspec
  • 4 Solutions collect form web for “How to get email diffs for GitHub pushes?”

    I’ve written a small WebHook that exactly fills this gap: gitdub. It leverages git-notifier to send one email per commit.

    You are right, the GitHub Email Service hook doesn’t include diff: this is currently a feature request.

    J-16 SDIZ is also right, git-hook-update-notify-email would only be executed locally, not on GitHub side.

    That doesn’t mean said script cannot help: the idea would be to

    • setup a bare repo on your side, cloning the GitHub repo
    • setup a clone of that base repo
    • have a cron job (or Windows task) fetching the GitHub repo every 10 minutes
    • immediately push to the local non-bare repo

    In the local non-bare repo, you can:

    • either use a pre-receive hook (which, as described in the Git book, could be use to compute diff between old-rev and new-rev)
    • or use the aforementioned git-hook-update-notify-email

    In both cases, that mean setup this kind of service locally, which is not ideal.

    May not be the ideal answer for you but if you set up gitolite on your own server you can setup git-commit-notifer, get beautiful colored diff emails, and have unlimited git accounts since you own the server. I do this, and I have never looked back.

    Don’t have a server? You can get a micro Amazon EC2 instance for dirt cheap ($15 a month). We have up to 12 developers and 10 git repos and it all works great on a micro instance.

    The way of doing this is by adding a notification hook script which posts data to your system, with each commit that has been pushed to github.

    E.g.: the payload consists of each commits applied, each having an id:

      :before     => before,
      :after      => after,
      :ref        => ref,
      :commits    => [{
        :id        =>, <--- here

    Second step is to make your script trigger a call to github, using github API, that fetches each commit included in the payload. The response includes a diff for each file, which then you can email to your developers.


    GET /repos/:owner/:repo/commits/:sha

    :sha is the id of the commit you are getting the code for, and the response looks like this:

     "files": [
          "filename": "file1.txt",
          "additions": 10,
          "deletions": 2,
          "changes": 12,
          "status": "modified",
          "raw_url": "",
          "blob_url": "",
          "patch": "@@ -29,7 +29,7 @@\n....." <---- HERE

    Hope this helps. Please ask if you need more details about how to do it.

    Git Baby is a git and github fan, let's start git clone.