Git diff indicates the change of FileMode (old mode 100644, new mode 10075)

In today’s clone code, GIT status shows that a large number of files have been modified, and git diff prompts FileMode to change, as follows:

diff --git a/Android.mk b/Android.mk
old mode 100644
new mode 100755

The original is the change of FileMode. After Chmod, some bits of the file are changed. If we strictly compare the original file with the Chmod file, there is a difference between the two. However, the source code usually only cares about the text content, so the change of Chmod should be ignored. So set the following:

Cut to the root of the source code

git config --add core.filemode false

in this way, all your git libraries will ignore the FileMode change ~

supplement:

When the code is submitted to the warehouse, it is found that the files that have not been changed are prompted to be modified, and many files are prompted to be modified

However, the modified add line and delete line are both 0

So diff it

$ git diff code.c

old mode 100755

new mode 100644

It turns out that the file mode has changed

After thinking about it, maybe someone else submitted it from Mac and I pulled the code on win, which led to the change of file mode

I went to the Internet to see how to modify it

git config core.filemode false

You can also directly modify the FileMode (in the [core] section) field of the config file in the. Git directory of the code warehouse to change it to false

If you want to modify it globally, add the — global option:

git config --global core.filemode false

fileMode:

core.fileMode

If false, the executable bit differences between the index and the

working copy are ignored; useful on broken filesystems like FAT.

See git-update-index(1). True by default.

 

Similar Posts: