Git Errors and Lessons Learned

Day 102. Less theory. More breaking things. Yesterday I talked about DAGs and snapshots. Today I actually felt them. Went full practical. Here's what hit me: Error 1: Detached HEAD Checked out an old commit to inspect something. Forgot to create a branch. Made changes. Committed. Then switched branches and watched those commits disappear into the void. The graph doesn't lie. Floating commits with no branch pointing to them just... drift. Error 2: Merge conflict on main Two branches touched the same file. Git couldn't decide whose version wins. The <<<<<<< markers showed up and I actually read them this time instead of panicking. Resolved it manually. Committed the merge. Moved on. Error 3: reset --hard on the wrong branch Yeah. I typed the command on the branch I didn't mean to. Work gone. No staged changes. No warning. Lesson? git reflog saves lives. Every commit still lives in there for 30 days even after a hard reset. Error 4: Pushed to the wrong remote branch Force of habit. Wrong branch name. Had to git push origin --delete and clean it up. Not glamorous. But this is what sharpening actually looks like. Day 102. Still here. #Git #DevOps #100DaysOfCode #LearningInPublic #Infracodebase

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories