Assume no changes in Git tracked files

Git is great, I’ll sing its praise until the end of times. Lately I’ve been having some issues with configurations that I don’t want to push and since I’m not the one who made the decision to version certain files I’m not going to remove them or .gitignore them.

Git: assume unchanged

Git is great, I can keep track of a file and assume the local copy is unchanged by updating the index. To assume that a file has not been changed without removing it you will need to use the following command:

git update-index --assume-unchanged <file>

Git: assume changed

Git is still great, it can revert the process and restart tracking changes again with the following command:

git update-index --no-assume-unchanged

Git update-index

The magic happens thanks to git update-index, you can read more about it here:

Visual Studio Code sets core.filemode to true

Visual Studio Code is great customizable editor for Windows that is actually quite light compared to Visual Studio. It has support for multiple languages and SCM like Git.

But it has a major drawback, at least on Windows… It sets core.filemode to true in Git repositories. That’s bad because you might commit all the files that were not changed with the files that were changed because it sets the execution bit to true.

What is core.filemode?

Git tracks changes in files, even permissions. The setting core.filemode tells Git to track the file’s execution bit from its permissions. This can really mess up versioning.


You can either globally set core.filemode to false or set it on the current repository with the following command:

git config core.filemode false
git config --global core.filemode false # Sets it globally

Just to be sure I prefer to set it everytime I create a repository and I’ll be using Visual Studio Code.

Update: 2021-02-27

It appears that the PowerShell might ignore the .gitconfig from my home folder too, I’d need to investigate that further to verify this but the short version is: on Windows core.filemode might be set to true by default, so check your repository settings.