When publishing the project to the line, many times need to modify the file permissions, if the use of GIT version management software to publish, then the next time you update the online file will prompt file conflicts. Obviously the document has not changed, why conflict? It turns out that git also counts file permissions as part of the file differences. The following author has made a simple example to illustrate this situation.
1. Modify the permissions of the repository file, and then use diff to view the changes.
$ chmod 777 pack.php$ git diff pack.php
Git file Permissions Modification example
You can see that git also includes file permissions in version management.
2, in another Place clone this repository, modify the pack.php file, and then submit.
3. Update the content below the original repository.
$ git pull
Conflicts caused by Git file permissions modification
You can see a prompt conflict.
Workaround:
In Git, you can add a configuration that ignores file permissions, as follows:
$ git config core.filemode false
This sets the Ignore file permission. View the following configuration:
$ cat. Git/config
Git ignores the configuration of file permissions
Then update the code is OK.
Summarize:
I personally understand that version management more attention to the content of the file, more curious about why git file permissions in version management, it is estimated that some scenarios are needed. The author has tried to change the file owner and all the groups not included in version management. And how does git handle file permissions under Windows?
Git's approach to conflicts caused by file permissions modification and ignoring file permissions