Git Rescue: Undoing Mistakes with Git Reset and Revert

Day 25 of #90DaysOfDevOps was all about leveling up my "Git Rescue" skills! 🛠️ We’ve all been in that spot where a commit goes sideways, and knowing how to handle it safely is a true superpower for any DevOps engineer. ⚡ The TL;DR on Undoing Mistakes: 🔹 git reset ⏩ The "Time Machine." It rewrites project history by moving the branch pointer backward. Critical Rule: Use this only for private, local work that hasn't been pushed yet. 🚫 Do not rewrite shared history! 🔹 git revert ⏪ The "Safety Net." It creates a new commit that performs the inverse of an existing one. Because it adds to the history rather than deleting it, this is the gold standard for undoing changes on shared, pushed branches. ✅ Branching Strategies: Managing Code at Scale 🏗️ I also dove into how top-tier engineering teams manage their codebase: ♦️ Trunk-Based Development: 🛤️ High-velocity merging to main. Perfect for teams practicing CI/CD who need to ship fast. ♦️GitHub Flow: 🎈 Simple, branch-based, and PR-driven. My go-to for SaaS products and quick iterations. ♦️GitFlow: 🏢 Highly structured, multi-branch workflow. Ideal for large, complex projects with rigid release schedules. 📚 Check out my full technical notes here:  https://lnkd.in/g44eYvdQ #90DaysOfDevOps #DevOpsKaJosh #TrainWithShubham #Git #DevOps #VersionControl #SoftwareEngineering #CI_CD #CodingTips #LearningInPublic #TechCommunity

To view or add a comment, sign in

Explore content categories