What if someone accidentally checks in a password or private key? You can remove it, and check in a new version — but the sensitive info is still available in the version history. Version history is almost always a good thing, but not here. How do you fix it?

to remove a specific version

remove all references to it (delete the branch, etc)

git reflog expire --expire=now --all

git gc --prune=now



more: [1] [2]

to modify existing versions to remove specific files

[1] [2] [3]