我有一个项目,我必须chmod在开发过程中将文件模式更改为777,但不应在主回购中更改.
Git选择chmod -R 777 .并将所有文件标记为已更改.有没有办法让Git忽略对文件进行的模式更改?
看来Git无视 ~/.gitconfig
$ git config --global core.filemode false
$ git config -l
core.filemode=false
core.filemode=true
Run Code Online (Sandbox Code Playgroud)
所以现在有2个条目core.filemode,git仍然没有忽略filemode的变化
$ touch modetest
$ git add .
$ git commit -m test1
[master (root-commit) 320cfe4] test1
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 modetest
$ chmod +x modetest
$ git diff
diff --git a/modetest b/modetest
old mode 100644
new mode 100755
Run Code Online (Sandbox Code Playgroud)
根据torek的回答,我将这一行添加到了我的.bash_profile
[ -d .git ] && git config core.filemode false
Run Code Online (Sandbox Code Playgroud)