bessarabov
bessarabov

Reputation: 11871

Send mail after git commit not push

I need to send email with diff after commit to the repository. I know how to send emails after push, but it is not working for commits.

For pushes I've created hook post-receive that gets parameters . But the hook post-commit does not recieve any parameters and because of that I can't use my script that sends mail.

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

Upvotes: 4

Views: 1425

Answers (1)

bessarabov
bessarabov

Reputation: 11871

The answer is simple =) I've solved my issue by creating post-commit hook with this line:

git log -1 -p|mail -s "Git commit" [email protected]

Upvotes: 7

Related Questions