除了core.hooksPath全局钩子之外,如何运行本地Git项目钩子? [英] How to run local Git project hooks in addition to core.hooksPath global hooks?

查看:178
本文介绍了除了core.hooksPath全局钩子之外,如何运行本地Git项目钩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前我正在使用

git config --global core.hooksPath ~/.git/hooks

为所有git项目配置全局挂钩.但是,如果这些项目包含挂钩,则它们不会运行.

to configure global hooks for all my git projects. But if those projects contain hooks, they're not run.

我想运行全局挂钩以及项目挂钩.谢谢!

I'd like to run the global hook as well as the project hooks. Thank you!

推荐答案

我认为唯一的方法是让全局挂钩检查是否存在相应的本地挂钩并运行它.

I think the only way is for your global hooks to check if a corresponding local hook exists and run it.

这不是一个完整的解决方案,因为某些钩子( pre-push 例如)除了命令行参数外,还接受标准输入.如果其中一个钩子消耗了标准输入,则另一个钩子没有机会.

This is not a complete solution because some hooks (pre-push, for example) accepts standard input in addition to command line parameters. If one of the hooks consumes the standard input the other doesn't have a chance.

这篇关于除了core.hooksPath全局钩子之外,如何运行本地Git项目钩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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