Git预推钩 [英] Git pre-push hooks

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

问题描述

我想在每次git push之前运行一个单元测试,如果测试失败,取消push,但我甚至找不到pre-push hook,只有pre-commit和pre-rebase。

I would like to run a unit-tests before every git push and if tests fails, cancel the push, but I can't even find pre-push hook, there is pre-commit and pre-rebase only.

推荐答案

我宁愿在预先提交钩子中运行测试。因为更改在提交时已经记录。仅推送和交换有关已记录已更改的信息。如果测试失败,您的存储库中将会有一个损坏版本。无论你是否在推它。

I would rather run the test in a pre-commit-hook. Because the change is already recorded when committing. Push and pull only exchange information about already recorded changed. If a test fails you would already have a "broken" revision in your repository. Whether you're pushing it or not.

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

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