It happened to me quite a few times, so adding it here for my future self.
So you committed a file to remote, and realized it should’ve been ignored by Git. You add it to .gitignore
, but somehow, git still remembers the file. Here’s a quick fix:
From this stack overflow answer :
For a list of files
git rm --cached <file1> <file2>
For a directory:
git rm -r --cached <folder>