Remove a password from Git's commit history without deleting entire files

Ever accidentally committed a password in a file that you actually need? One of the advantages of using Git is that you can fix your horrible blunder with relative ease.

This example uses some code from Kevin van Zonneveld's helpful post and some knowledge from GitHub's guide to removing sensitive data. Kevin's example uses a new Git repo, but I used a similar process to fix an existing one.

I'm also using GitHub as my Git host, so there may be changes if you need to do this elsewhere.

WARNING: This can break your stuff. Backup and be careful.