How do I make Git ignore file mode (chmod) changes?

后端 未结 11 1242
天命终不由人
天命终不由人 2020-11-22 02:29

I have a project in which I have to change the mode of files with chmod to 777 while developing, but which should not change in the main repo.

Git pick

11条回答
  •  一向
    一向 (楼主)
    2020-11-22 02:48

    undo mode change in working tree:

    git diff --summary | grep --color 'mode change 100755 => 100644' | cut -d' ' -f7- | xargs -d'\n' chmod +x
    git diff --summary | grep --color 'mode change 100644 => 100755' | cut -d' ' -f7- | xargs -d'\n' chmod -x
    

    Or in mingw-git

    git diff --summary | grep  'mode change 100755 => 100644' | cut -d' ' -f7- | xargs -e'\n' chmod +x
    git diff --summary | grep  'mode change 100644 => 100755' | cut -d' ' -f7- | xargs -e'\n' chmod -x
    

提交回复
热议问题