Pretty Git notification emails using PHP

In this post I showed how to configure Smart HTTP on Virtualmin.  What was immediately obvious upon your first commit was that the alert emails stunk.  There were no code diffs and as plain text, they were largely unreadable anyway.

There are a lot better emailing projects that show nicely-formatted HTML mails, with diffs, but none were in PHP so the gitmailer project, as a drop-in replacement for the default post-receive-email script, was born.  Clone the Github project from that link and configure it by changing the bash file in /home/domain/public_html/git/reponame.git/hooks/post-receive to be

[...]
echo "Sending notification email..."
php /path/to/gitmailer/gitmail.php `which git` `pwd`
[...]

Enjoy.

 

Updated 2/22/2013 to reflect latest gitmail.php syntax.

Leave a comment

Your email address will not be published. Required fields are marked *