How To Ignore Mode Changes In Git

Git will track changes to files and directories, including any changes to permissions done via chmod. In most development environments I tend to have a different set of permissions to those on the live site so I am usually not interested in tracking permissions changes. To prevent git from looking at the difference between the permissions of a file you need to set the core.filemode configuration option to false.

git config core.filemode false

Here is the entry from the git-config(1) manual page.

core.fileMode
   If false, the executable bit differences between the index and the working tree are ignored; useful on broken 
   filesystems like FAT. See git-update-index(1).

   The default is true, except git-clone(1) or git-init(1) will probe and set core.fileMode false if appropriate 
   when the repository is created.

This information was originally taken from this post on Stackoverflow. I am always forgetting how to do this, so as an aid to memory I am writing this post.

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
7 + 9 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.