Ignoring files in git can be in the well known .gitignore file or in the .git/info/exclude file.

What's the difference between the two files?

File

Description

.gitignore

Operates at the repository level and everyone is sharing this file.

.git/info/exclude

Operates at the local working directory (i.e. normally the root of the cloned repository) level and only you has this file.

Exclude File

If .git/info/exclude file is present it must have the same formatting rule as the .gitignore file.

If the file to be ignored was already in the repository and you can still see it as modified. You can execute the following command:

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

Example:

git update-index --assume-unchanged config/database-config.xml

The reversal of this command is the following:

git update-index --no-assume-unchanged <FILENAME>