This one time, I pushed some code to my branch and later on I saw that I had pushed the .env branch with a lot of secrets on the repo. I panicked. Even more so by seeing that the .env file was in all of my commits for that branch. I started looking for git commands that can be used to completely erase the existence of a file from the whole commit history and found a very obsure and VERY long command which for the life of me I can’t find again.

Alt Text

Anyways, after a copy paste later, I had created a duplicate commit for each of my commit in the tree. Each pair consisted of one commit that had the .env file and one that didn’t. My 50 commits became 100 commits and my project lead was of course furious and curious as to why I had pushed 50 more commits at once. I explained the whole situation to him.

Turns out they themselves had pushed the .env file on the master branch and all of the credentials inside it were of the development cluster. When I asked why it is so, they said that the repository is private anyway :shrug:.

Feel free to share your stupid work story :)