为什么git没有预推钩? [英] Why doesn't git have a pre-push hook?

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

问题描述

我想在我将更改推送到远程(位于bitbucket上)之前运行我的测试。

我通常会分出主人,当功能完成时,我会将其合并回主控和推送,这就是我寻找预推钩的原因。相反,我使用了一个合并后的&预先提交限制为主分支。
我见过为Git 1.6完成的补丁这个其他问题,这正是我提出的解决方案的问题。



我想知道的是 为什么 然后git不支持pre-push hook(特别是如果补丁已经已经接受过一次)?
(顺便说一句 - 我在最新的git版本)

解决方案

在我看来,



Git在预推送钩子> 1.8.2 release。



示例预推送脚本: https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3 /templates/hooks--pre-push.sample b
$ b 1.8.2发布说明讨论新的预推钩: https://github.com/git/git/blob/master/Documentation/RelNotes /1.8.2.txt

I would like to have a hook to run my tests before I push my changes to the remote (which sits on bitbucket).

I usually branch off master and when the feature is done I merge it back to master and push, which is why I was looking for the pre-push hook. Instead, I have used a post-merge & a pre-commit restricted to the master branch. I've seen that patch done for Git 1.6 and this other question that raises exactly my problem with it's proposed solution.

What I would like to know is why git does not support the pre-push hook then (especially if a patch has been accepted already once)? (btw - I'm on the latest git version)

解决方案

It, in my opinion, has always been a question of when and not why.

Git got the pre-push hook in the 1.8.2 release.

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

1.8.2 release notes talking about the new pre-push hook: https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt

这篇关于为什么git没有预推钩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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