You can also use bfg for ease.
The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history:
Removing Crazy Big Files
Removing Passwords, Credentials & other Private data
$ bfg --delete-files YOUR-FILE-WITH-SENSITIVE-DATA
Or just replace all the occurrences of some file:
$ bfg --replace-text passwords.txt
check https://rtyley.github.io/bfg-repo-cleaner/ and https://help.github.com/articles/removing-sensitive-data-from-a-repository/