If you want this to only happen on your local system, the local .git/info/exclude
file should solve the problem.
To requote the answer from the above stack post:
Patterns which are specific to a particular repository but which do
not need to be shared with other related repositories (e.g., auxiliary
files that live inside the repository but are specific to one user's
workflow) should go into the $GIT_DIR/info/exclude file
.
The .git/info/exclude
file has the same format as any .gitignore file. Another option is to set core.excludesFile to the name of a file containing global patterns.
Note, if you already have unstaged changes you must run the following after editing your ignore-patterns:
git update-index --assume-unchanged [<file>...]
Note on $GIT_DIR: This is a notation used all over the git manual simply to indicate the path to the git repository. If the environment variable is set, then it will override the location of whichever repo you're in, which probably isn't what you want.