简体   繁体   English

使预提交挂钩忽略子模块

[英]Make pre-commit hooks ignore submodules

I have a git repo with a couple of submodules whose code contents are out of my control.我有一个 git 存储库,其中有几个子模块,其代码内容超出了我的控制范围。 I would like to ignore these submodules in all pre-commit hooks.我想在所有预提交挂钩中忽略这些子模块。 Is there any way of achieving this short of manually specifying the folders in which these submodules reside for every individual hook?有没有什么方法可以实现这一点,而不是为每个单独的钩子手动指定这些子模块所在的文件夹?

submodules should be ignored by default -- they get a special type tag of submodule which usually doesn't go through the normal git hooks (which by default have a filter of [file] ).默认情况下应忽略子模块——它们通过普通的 git 钩子(默认情况下具有[file]过滤器)获得submodule的特殊type标签,通常不会 go 。

my guess is your configuration escapes the normal way of using hooks and does something like flake8.我的猜测是您的配置逃脱了使用钩子的正常方式并执行flake8. -- in which case you should switch to filename-based hooks. -- 在这种情况下,您应该切换到基于文件名的挂钩。 It's impossible to know without seeing your configuration though so please share that with an edit但是,如果不查看您的配置就不可能知道,因此请与编辑分享


disclaimer: I'm the creator of pre-commit免责声明:我是预提交的创建者

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM