git – adding e-mail alerts & hooks
By admin
Before you do anything, you may want to back up the file .git/hooks/post-receive in your project directory or at least view it to make sure that there's nothing in it.
Now, get a copy of the git source code:
git clone git://git.kernel.org/pub/scm/git/git.git
Overwrite the post-receive in your hook folder with the file git/contrib/hooks/post-receive-email :
cp git/contrib/hooks/post-receive-email /var/data/repos/myproject/.git/hooks/post-receive
Now, go to your project home and add the git-config variable:
cd /var/data/repos/myproject/
git-config hooks.mailinglist “kenglish@someweakdomain.org”
git-config hooks.mailinglist “[GIT-MYPROJECT] “
Now test it out, do a git-commit -a on your repository and push it to the master. Should send an e-mail about the checkin.
BONUS:
By default, the script will just e-mail you that files have checked in. If you want to Email the diffs of the files themselves, basically, copy the diff of from that guys post into your post-receive file. THen set hooks.emailprefix=1
with:
git-config hooks.emailprefix 1



September 15th, 2008