Removing your GitHub commit history
If you mistakenly add a secret to your GitHub repo, like a password, API key or private key a delete and commit won't be good enough. Hackers will still be able to search your commit history.
This guide will show you how you can delete your github commit history to prevent any future damage.
First Method
Deleting the .git
folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:
This will not keep our old commits history around. But sometimes this does not work if not, try the next method below.
Second Method
Last updated