查看 git status
发现 submodules 子模块们一堆莫名其妙的改动
cd 进去,git diff
...
old mode 100644
new mode 100755
...
old mode 100644
new mode 100755
...
……嗯。嗯?!
我不是早就 git config --global core.filemode false
全局忽略了权限改变吗???
于是进入某个子模块文件夹运行 git config --list
...
core.filemode=false
...
core.filemode=true
...
居然有两个 core.filemode
,后面的覆盖了前面的,没有生效。
翻了翻 submodule 里面的 config,发现项目内设定默认为 core.filemode true
,因为项目内的 config 优先级比全局大,所以即使全局设定为 core.filemode false
,该 submodule 内仍然会追踪权限改变。
git clone
, git init
,git submodule
等命令都会默认把这项设定为 true 不管全局是如何设定的,如果要默认为 false,需要加上 --config core.filemode=false
。
可是总不能一个个手动进去改 114514 个 submodule 罢。
于是运行 git submodule foreach git config core.filemode false
,问题解决。
> git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean