Do git reset -hard to ignore permission changes

I am trying to git reset --hard origin/master , but I will do git somehow check files only if the actual content of each file has changed, instead of checking them even if only permissions have changed.

Is there any parameter that I can pass to git reset, or that thing that can only be solved with a script?

+4
source share
2 answers

I managed to solve the problem through Git ML .

So basically:

 git update-index --refresh 

before: git reset did the trick :)

+3
source

Try setting core.fileMode to false as described here ( docs ) ( git config core.fileMode false should do the trick). Git seems to ignore any resolution changes during a hard reset. Now I found that if Git could not read the file (for example, I set the permissions to 000), a hard reset will restore the original permissions with which it was associated.

Another thought that might be of interest would be to write a hook that would set the permissions of all the files in the repo, whatever you want. It can also give you the confidence that you did not accidentally leave a new file with dangerous permissions.

+2
source

Source: https://habr.com/ru/post/1485400/


All Articles