2011-05-16 148 views
2

我想在有人提交更改后显示警告消息。提交后显示警告消息

$ git commit -am "First commit" # Or `git commit -a` and then type a message in the editor 
Please, don't forget to update the production repository 

我唯一的限制是它不能完成所有的Git仓库,它只能在特定的目录中工作。

这可能吗?

回答

1

你可以用post-commit钩子来做到这一点。该documentation for that hook说:

后提交

该钩子被调用的git提交。它不接受任何参数,并在提交完成后调用。这个钩子主要用于通知,并且不会影响git commit的结果。

...所以你可以安装一个post-commit钩子来回应你提到的消息。如何让你的用户安装这个钩子是另一回事,在堆栈溢出的其他答案中有介绍,例如, Can Git hook scripts be managed along with the repository? ....