If a file is tracked by Git, adding it to .gitignore won’t stop Git from tracking it since .gitignore only applies to untracked files.
To prevent file changes of a .gitignore file from showing up during git status, you can do the following:
Ignore changes
To ignore changes of tracked <file>:
git update-index --assume-unchanged <file>
To start tracking changes of <file> again:
git update-index --no-assume-unchanged <file>
Remove file
To remove tracked file <file>:
git rm --cached <file>
git commit -m 'chore: remove file'