开发者

Display warning message after commit

I want to display a warning message after someone commits a change.

$ 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

The only restriction that I have is that it can't be done to all Git repositories, it has to work only in specific directories.

Is this possibl开发者_JAVA技巧e?


You can do this with a post-commit hook. The documentation for that hook says:

post-commit

This hook is invoked by git commit. It takes no parameter, and is invoked after a commit is made. This hook is meant primarily for notification, and cannot affect the outcome of git commit.

... so you can just install a post-commit hook that echos your message you mention. How you get your users to install this hook is a different matter, covered in other answers on Stack Overflow, e.g. Can Git hook scripts be managed along with the repository?....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜