有没有办法绕过git post-commit钩子?

时间:2019-02-11 14:45:54

标签: git

This answer可以很好地绕过预提交钩子,但是跳过预提交的最好方法似乎是通过以下方式将其禁用:

gitdir="$(git rev-parse --git-dir)"
hook="$gitdir/hooks/post-commit"

# disable post-commit hook temporarily
[ -x $hook ] && chmod -x $hook

git commit -a -m "Commit all changes for testing. Will be reverted automatically"

# enable it again
chmod +x $hook

取自here

问题是-有更好的方法吗?

我怀疑的原因是,通过删除执行权来禁用该钩子似乎是阻止某些事物运行的一种非自然方式。检查完网络后,我发现了一种跳过pre-commit大小写的自然方法-我们可以为git提供一个跳过检查的选项。基本上,我的问题是我们是否有类似的东西,或者或多或少地被接受来做事情。

0 个答案:

没有答案
相关问题