git推后的本地执行钩子? [英] Local executing hook after a git push?

查看:211
本文介绍了git推后的本地执行钩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了 githooks manpage ,但除非我错过了某些东西,没有看到本地推后git钩子的选项。在将主分支推送到GitHub仓库后,我希望有一个更新我的web服务器上的api文档(为此我已经有一个脚本)。当然,我可以编写自己的脚本,将git push和api docs运行结合起来,但这样感觉有点不雅。

>从Git 1.8.2开始,在push操作之前调用一个新的钩子: pre-push 如果脚本返回0以外的值,那么push操作将被取消。



在发行说明中提及: https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt#L167



示例:< a href =https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample =noreferrer> https://github.com/git/git/blob /87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample


I've looked at the githooks manpage but unless I'm missing something I don't see an option for local, post-push git hooks. I'd like to have one that updates the api docs on my web server (for which I already have a script) after I push the master branch to the GitHub repo. Of course I could just write my own script that combines the git push and the api docs run, but that feels somewhat inelegant.

解决方案

From Git 1.8.2 there is a new hook invoked before the push operation: pre-push If the script returns other than 0 the push operation will be cancelled.

Mention in the release notes: https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt#L167

Sample: https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample

这篇关于git推后的本地执行钩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆