There are times notifications aren't wanted about either a changed repo file or a new file that needs to be added to the repo. However, adding the name of the file to .gitignore
might not be a good option, either. For example, locally-generated files that other users aren't likely to generate (e.g., files created by an editor) or files of experimental test code might not be appropriate to appear in a .gitignore
file.
In those cases, use one of these solutions:
-
If the file is a changed repo file
Use the command:
git update-index --assume-unchanged "$FILE"