3
My first git push accidentally went to the main branch at 3am
I was working on a little web project in my dorm room last night around 3am and forgot to switch branches. Typed 'git push origin main' instead of my feature branch and it overwrote the whole live site with my half-baked code. The site went down for like 10 minutes while I panicked and reverted it. Has anyone else messed up a push and had to fix it in a hurry?
2 comments
Log in to join the discussion
Log In2 Comments
riley_bell14d ago
Pulled a similar all nighter a few months back and pushed a broken CSS file to production. Site looked like a 90s GeoCities page for a solid 15 minutes. What saved me was having a local backup of the previous version I could force push back to main. I learned to always do a quick git log and grab the last good commit hash before pushing anything after midnight. Setting up a pre push hook that checks your branch name also stops this from happening again. Now I keep a sticky note on my laptop that says 'check branch dummy' in big red letters.
2
jana_lewis1614d ago
lol "check branch dummy" is iconic. I actually read this article a few weeks back about how a lot of midnight deploys fail because your brain just skips over those little checks. It said something like after 11pm your decision making drops to basically zero. That sticky note trick is gold though. I should try something similar with my workout logs so I stop grabbing the wrong weight plates when I'm tired.
3