Git挂钩管理 [英] Git hooks management

查看:100
本文介绍了Git挂钩管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在我们的项目中使用自定义编写的Git钩子。钩子被存储在一个项目的仓库中,当它们发生变化时,为了获得一个新版本,每个用户都必须在他的.git / hooks目录中手动复制这些钩子。这是相当不方便的。

改进这种方法的一种方法是让.git /钩入符号链接到工作树中。但是这意味着每个分支(即使用户的本地功能分支正在开发中)都应该具有最新版本的钩子。这是不方便的。



你会如何解决这个问题?

解决方案



我同意,如果Git有内置的传播钩子的机制,脚本,但它不。


We use custom-written Git hooks in our project.

Hooks are stored in a project's repository, and, when they do change, to get a new version each user must copy them manually in his .git/hooks directory. This is rather inconvenient.

One way to improve this is to make .git/hooks a symlink into worktree. But this would imply that each branch (even user's local feature branches under development) should have the most current version of hooks. This is not convenient as well.

How would you solve the problem?

解决方案

Maintain a separate repository of your hooks and symlink into that.

I agree, it'd be nice if Git had a built-in mechanism for propagating hooks scripts but it doesn't.

这篇关于Git挂钩管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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