windows - git add hook / getting git to ignore file modes of new files -


I am working with both the windows and the GIT repository on Linux / Mac. When I create new files on windows, or edit them in some text editors, the file mode is converted to 775. I have to say GIT

  git config core.filemode false   

but I also have to say that most new files are mode 664 (not 775). The best I've come with so far is the pre-committed hook.

  git diff --cached --name-only | Egrep -v '. (Bat | pays | sh | exe) '| Xargs -d "\ n" chmod 664 git diff --cached --name-only | Egrep -v '. (Bat | pays | sh | exe) '| Xargs -d "\ n" git add   

But if I've added a new file, then it works incorrectly, then it is edited before editing it, and Then it was replaced without adding it is a better way to do this, or is there anything like a pre-add or post-add hook?

Edit: git diff --cached --name-only also gives me the files which have been deleted, so what I really want is git diff There is something like --cached --name-only --diff-filter = ACMRTUXB

chmod and instead of reading, you can go to git update-index --chmod = -x & lt; Files & gt; to modify the index directly.

Comments