
I Destroyed a Production Database With One Git Command. Here's What I Learned.
It was 2 AM on a Thursday. I was 17, working on a freelance project for a small e-commerce company. They had about 500 active customers. I was supposed to push a minor CSS fix to staging. Instead, I ran git push --force to the wrong branch. Then I ran the deployment script that was hooked to that branch. Then I watched in horror as the migration script -- one I had been testing locally with destructive resets -- ran against the production database. 1,247 customer records. Gone. This is the story of the worst night of my coding life and everything I learned from it. How It Happened Let me set the scene. I was working on two branches: feature/checkout-redesign -- a big feature branch with database migrations hotfix/button-color -- a tiny CSS fix I had been doing git rebase on the feature branch to keep it clean. The rebase required a force push. Normal stuff. But I had the wrong branch checked out. Here's what I typed: git push --force origin main I meant to type: git push --force origin
Continue reading on Dev.to Beginners
Opens in a new tab




