Github Commit Emails with Full Diff of Changes

email tools ruby

Finally, diff emails for github! Folks who excessively use version control software like to track the progress of a project by just inspecting the commit messages which contain an incremental diff. Git users who manage their own repository infrastructure can already today enjoy Robin Sommer’s git-notifier, a small utility which sends out emails containing detailed diffs of the changes. It works by adding git-notifier as post-receive hook in the remote bare repository.

When hosting the repository at github this doesn’t work anymore, because github does not offer direct access to the bare repository, but instead offers a predefined set of service hooks. Alas, the existing email hook cannot send out diffs, which greatly limits its usefulness. This poses the question: can github users still obtain emails with diffs?

git-notifier + github = gitdub

Enter gitdub: a slim sinatra HTTP server that utilizes github’s webhook API to feed git-notifier. More specifically, when adding gitdub as webhook for your git repository, each push elicits a HTTP POST request with details about the changeset. Gitdub parses this data, updates its corresponding local bare git repository, and then invokes git-notifier to mail out the diffs.


To start dubbing your commits with gitdub, you only need a machine with a public IP address that can receive inbound TCP connections. In a nutshell, setting up gitdub involves configuring a webhook for your github repository creating a YAML configuration file. The example below shows a brief configuration file, a more detailed, commented version exist in the repository.

  port: 8888
  allowed_sources: [,,]

  from: gitdub
  to: [,]

  - id: mavam/gitdub
    to: []
    subject: '[git/gitdub]'
  - id: mavam/.*
    to: []

The last block github contains information about your github repositories. Gitdub processes the blocks sequentially and tries to match the id field against the data from the commit, where the first match “wins.” In the above example, there exists an entry for mavam/gitdub and then a wildcard entry for all commits of user mavam. In each entry, you can overload settings from the notifier block. For a complete example, please refer to the gitdub README.


An exemplary email from git-notifier looks like this:

Repository : ssh://

On branch  : topic/matthias/opaque
Link       :


commit 483cc6bd9eebb4883b5784f39325253581e9cb30
Author: Matthias Vallentin <>
Date:   Thu Dec 13 17:51:42 2012 -0800

    Fix a hard-to-spot bug.


 src/ |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/ b/src/
index 30ff3ce..a78da7f 100644
--- a/src/
+++ b/src/
@@ -1294,7 +1294,7 @@ bool OpaqueType::DoUnserialize(UnserialInfo* info)
        char const* n;
-       if ( ! UNSERIALIZE_STR(&n, 0) );
+       if ( ! UNSERIALIZE_STR(&n, 0) )
          return false;
        name = n;
        return true;

Gitdub code comes with a BSD-style license. I much appreciate feature requests, bug reports, or any other form of feedback. Happy project tracking!

Load Comments