Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
提交到存储库后,我需要发送带有差异的电子邮件。我知道如何在推送后发送电子邮件,但它不适用于提交。
对于推送,我创建了获取参数的钩子 post-receive。但是钩子 post-commit 没有收到任何参数,因此我不能使用我的脚本来发送邮件。
也许有一种方法可以在 post-commit 钩子中获取有关 newrev 和 refname 的信息,或者还有其他方法可以在提交后发送邮件?
答案很简单 =) 我已经通过使用这一行创建提交后挂钩解决了我的问题:
git log -1 -p|mail -s "Git commit" mail@example.com