<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,2 +1,3 @@
 .DS_Store
 deploy.rb
+*~</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,17 @@
 service :email do |data, payload|
 
   name_with_owner = File.join(payload['repository']['owner']['name'], payload['repository']['name'])
+
+  # Should be: first_commit = payload['commits'].first
+  first_commit_sha, first_commit = payload['commits'].select { |c| c }
+
+  # Shorten the elements of the subject
+  first_commit_sha = first_commit_sha[0..5]
+
+  first_commit_title = first_commit['message'][/^([^\n]+)/, 1]
+  if first_commit_title.length &gt; 50
+    first_commit_title = first_commit_title.slice(0,50) &lt;&lt; '...'
+  end
   
   body = &lt;&lt;-EOH
 Commits to #{name_with_owner}
@@ -10,20 +21,35 @@ Home: #{payload['repository']['url']}
 
 EOH
 
+
   payload['commits'].each do |gitsha, commit|
+    added    = commit['added'].map    { |f| ['A', f] }
+    removed  = commit['removed'].map  { |f| ['R', f] }
+    modified = commit['modified'].map { |f| ['M', f] }
+
+    changed_paths = (added + removed + modified).sort_by { |(char, file)| file }
+    changed_paths = changed_paths.collect { |entry| entry * ' ' }.join(&quot;\n  &quot;)
+
+    timestamp = Date.parse(commit['timestamp'])
+
     body &lt;&lt; &lt;&lt;-EOH
-#{commit['timestamp']} - #{commit['author']['name']} (#{commit['author']['email']})
-#{commit['url']}
+Commit: #{gitsha}
+Author: #{commit['author']['name']} &lt;#{commit['author']['email']}&gt;
+Date: #{timestamp} (#{timestamp.strftime('%a, %d %b %Y')})
+Url: #{commit['url']}
+
+Changed paths:
+  #{changed_paths}
 
 #{commit['message']}
 
 
 EOH
   end
-  
+
   message = TMail::Mail.new
   message.set_content_type('text', 'plain')
-  message.subject = &quot;[GitHub] Push: #{name_with_owner} - #{payload['ref'].split('/').last}&quot;
+  message.subject = &quot;[#{name_with_owner}] #{first_commit_sha}: #{first_commit_title}&quot;
   message.body    = body
   message.date    = Time.now
   </diff>
      <filename>services/email.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>564315c9339f28073a183f7903ed6fdb01d98e2a</id>
    </parent>
  </parents>
  <author>
    <name>Eric Lindvall</name>
    <email>eric@5stops.com</email>
  </author>
  <url>http://github.com/pjhyett/github-services/commit/d73a9e628b92c31390023d51ffa83b07500efff8</url>
  <id>d73a9e628b92c31390023d51ffa83b07500efff8</id>
  <committed-date>2008-07-09T22:18:36-07:00</committed-date>
  <authored-date>2008-07-09T22:18:36-07:00</authored-date>
  <message>Improving email format.

This includes a second line for testing.</message>
  <tree>7062b6584b6392902c33953013ec07b68a648989</tree>
  <committer>
    <name>Eric Lindvall</name>
    <email>eric@5stops.com</email>
  </committer>
</commit>
