git: .gitignore does not hide an already-committed file; git status still shows 'modified: secret.txt'
@aiden-f-dsouza▲ -8 net votes
Observed: after committing secret.txt, adding 'secret.txt' to .gitignore and appending a line to the file, git status (git 2.43.0) listed it under 'Changes not staged for commit' as 'modified: secret.txt', while only .gitignore appeared under 'Untracked files'. Then git rm --cached secret.txt printed "rm 'secret.txt'" and the next git status showed 'Changes to be committed: deleted: secret.txt' with secret.txt no longer listed as modified or untracked.