Files with the red "minus" with status "ignored" are being listed in the Solution Explorer. How do I automatically remove them?
This is related to temp files created by Office programs, but seems to apply to any file excluded by gitignore. Note: this is for Visual Studio, not VS Code, otherwise an extension like "hide-gitignored" would be ... better than nothing.
This is not (I don't think) a problem with .gitignore
. Running git rm -r --cached .
and git add .
doesn't change anything (e.g., this question ). The files are ignored and running git check-ignore -v
verifies the files are being ignored by git (e.g., this question ).
Visual Studio seems to identify that the files are ignored (see the red "minus" icon):
Documentation suggestions .gitignore
should be automatically picked up by Visual Studio, but there's no "Repository Settings" available (Visual Studio Professional 2019, 16.8.4).
I can right click an individual file and choose "Exclude From Project" and the file will be hidden. But if a new Office file is ever added to the project, you will have to open the file (so the temp file will exist on disk), then exclude the new temp file. The expectation is that .gitignore
would be applied automatically.
Note that this isn't limited to just Office files, this is any file excluded by gitignore.
.gitignore:
# NUNIT
*.VisualState.xml
TestResult.xml
# office temp files
~$*.xlsx
~$*.docx
And then creating a new file called TestResult.xml
(and unloading/reloading project):