Send mail after git commit not push

I need to send an email with diff after committing to the repository. I know how to send emails after clicking, but it does not work for commits.

For pushers, I created a hook post-receive that receives parameters. But the post commit hook does not receive any parameters, and because of this, I cannot use my script that sends mail.

Maybe there is a way to get information about newrev and refname in a post-commit hook, or is there another way to send mail after a commit?

+4
source share
1 answer

The answer is simple =) I solved the problem by creating a post-commit hook using this line:

git log -1 -p|mail -s "Git commit" mail@example.com 
+6
source

All Articles