I do not know if you have faced this problem before, but if you are in a team maybe some of your colleagues or even you, had uploaded a file into the repository that should not be there, and then we found ourselves asking "What can we do to remove this file?".
First, we had to have put this file or file folder in our .gitignore file so that no one can upload it, not even by mistake. But don't worry we can fix it right away, just follow this simple steps.
(This is an example of a change in a .gitignore file)
## ADDING LOG FOLDER TO IGNORE AND ALL ITS FILES (Example) log*
git add . git commit -m ".gitignore updated"
3. Remove the cache in your repository (this command is doing the job we wanted, it will remove all the files uploaded that should have been ignored)
git rm -r --cached .
git add . git commit -m "Files removed from .gitignore"
And that is all, now you are able of updating any .gitignore file.