Sometime happen that we forget properly configure .gitignore
file and keep tracking some file with sensitive data.
Firstly, remove a file from staging area:
$ git rm --cached <filename>
Then install git-filter-repo
from here https://github.com/newren/git-filter-repo, e.g.:
$ pip install git-filter-repo
And finally, remove the file from all branches and all commits:
$ git filter-repo --invert-paths --path <filename>