How do I configure the appropriate Git hook to send a summary email whenever a set of changes is pushed to the upstream repository?
setting hooks.showrev is making no distinguishable difference? :-/
Sample conf:
# less users/cj.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = true
[hooks]
mailinglist = cj@yoga.ee
showrev = "git show -C %s; echo"
emailprefix = "[sabu gitosis server] "
I managed to do this, but had to opt for using the contrib script, not the other (perl) script by Alexandre Julliard. It seems fancier and more configurable, but with postfix I had no mail command which would accept "-s"? Here's my way:
http://pastie.textmate.org/695323
It would be nice to show some more info, like the full patch, gitweb link and commit graph as well, but this script can only do the first - if I play around with hooks.showrev it seems.
Anyway, cheers and thanks for the suggestions!
If you use GitLab you can use the 'Email-on-push' project service for this, it can be found under services in project settings.
In GitLab under your repository:
There opens a new page Emails on push
Also there is an option for Disable code diffs which exclude possibly sensitive code diffs in notification body. It is optional.
For more details: Click Here
Robin Sommer's git-notifier generates also very nice summaries in the following format:
Subject: [git/git-notifier] master: Adding www target to Makefile. (7dc1f95)
Repository : ssh://<removed>/git-notifier
On branch : master
>---------------------------------------------------------------
commit 7dc1f95c97275618d5bde1aaf6760cd7ff6a6ef7
Author: Robin Sommer <robin@icir.org>
Date: Sun Dec 19 20:21:38 2010 -0800
Adding www target to Makefile.
>---------------------------------------------------------------
Makefile | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index e184c66..9c9951b 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,8 @@ VERSION = 0.1
DISTFILES = git-notifier README COPYING
+WWW = $(HOME)/www/git-notifier
+
all:
dist:
@@ -13,3 +15,7 @@ dist:
cp $(DISTFILES) git-notifier-$(VERSION)
tar czvf git-notifier-$(VERSION).tgz git-notifier-$(VERSION)
rm -rf git-notifier-$(VERSION)
+
+www: dist
+ rst2html.py README >$(WWW)/index.html
+ cp git-notifier-$(VERSION).tgz $(WWW)
Another, more modern way to do this is with git-multimail, as suggested by Chords below.
This is how you did it in 2009.
You could add something like this to your post-receive hook in $GITDIR/hooks, or use the script in the contrib directory of the source (Available here)