To start out, move the post-receive.sample script from your git hooks directory to just plain post-receive like so:
mv post-receive.sample post-receive
Then in your git config file add the below, below any existing configuration items. Note, you will need to change the URL and repository name (currently named “git-repository”) before this will work.
[hooks] mailinglist = email@example.com emailprefix = "git-repository: " showrev = "t=%s; printf 'https://example.com/secure/?p=git-repoistory;a=commitdiff;h=%%s' $t; echo;echo; git show -C $t; echo;"
And there you go, when you now push to the repository, you will receive an email send to “mailinglist” with the changes made in a nice diff and a link back to your main git repository site.