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

后端 未结 11 1247
天命终不由人
天命终不由人 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:39

    By definining the following alias (in ~/.gitconfig) you can easily temporarily disable the fileMode per git command:

    [alias]
    nfm = "!f(){ git -c core.fileMode=false $@; };f"
    

    When this alias is prefixed to the git command, the file mode changes won't show up with commands that would otherwise show them. For example:

    git nfm status
    

提交回复
热议问题