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
Git Rescue: Undoing Mistakes with Git Reset and Revert
More Relevant Posts
-
My first post! Let's talk about the one tool that sits at the heart of every DevOps workflow: Git. 🧵 When I first started in DevOps, I thought Git was just "code backup." I used to zip folders with names like deploy_final_v2_FINAL.zip 😅 (please tell me I wasn't alone). If you're just starting your DevOps journey, don't let Git intimidate you. In our world, Git isn't just version control — it's the source of truth for everything: infrastructure, configuration, deployment pipelines, and application code. Here are 3 fundamentals that clicked for me: 1️⃣ Commit early, commit often — but make it meaningful. In DevOps, every commit can trigger a pipeline. Small, atomic commits mean faster feedback loops. Your CI/CD pipeline will thank you when it's not sitting through a 20-minute build just to find a typo at the end. 2️⃣ Treat infrastructure the same as application code. Your Terraform, Ansible, Kubernetes manifests — they all belong in Git. If it's not in Git, it doesn't exist. Period. This is the foundation of GitOps — your Git repo should be the single source of truth for both apps AND infrastructure. 3️⃣ Master the merge, but understand the strategy. git merge vs git rebase isn't just a preference — it's about maintaining a clean, auditable history. In DevOps, that history helps you trace exactly when and why infrastructure changed during an incident. Trust me, being able to pinpoint "which commit broke production" saves hours of debugging at 2 AM. 💡 For my fellow DevOps engineers: We all know the basics. But what's one Git command or practice you've baked into your CI/CD pipelines that saved your team during an outage? For me, it was git bisect — automating it in our pipeline to find exactly which commit introduced a performance regression. Absolute game-changer for root cause analysis. Drop your GitOps wisdom in the comments! Let's help the next generation of DevOps engineers level up. 👇 #git #devops #gitops #cicd #terraform #kubernetes #infrastructureascode #softwareengineering
To view or add a comment, sign in
-
-
🔥 Day 4 of My DevOps Journey Today, I learned one of the most powerful concepts in Git — Branching 🌿 At first, I used to think everyone works on the same code… but that would create chaos 😅 💡 What I learned: Branching allows developers to work on new features without affecting the main code. 🛠️ Commands I practiced: ✔️ "git branch" → Create branch ✔️ "git checkout" → Switch branch ✔️ "git checkout -b" → Create + switch ✔️ "git merge" → Merge changes 🚀 Real-world understanding: Teams use branches to safely develop features and then merge them after testing. This made me realize how structured and efficient DevOps workflows actually are 💻 Learning something new every day 💪 #DevOps #Git #GitBranching #LearningJourney #Consistency #AWS
To view or add a comment, sign in
-
🚀 GitHub for DevOps – Day 4 (Part 5) 🔁 Git Revert vs Git Reset – Know the Difference (Very Important in Production) In real-world DevOps environments, handling mistakes safely is more important than just fixing them. Let’s understand two commonly confused commands: git revert and git reset 🔹 1️⃣ Git Revert – Safe Undo (Recommended for Shared Branches) 👉 git revert is used to undo a commit without deleting history 📌 What it does: Creates a new commit Reverses the changes of a specific commit Keeps history clean and traceable 📍 Example: git log --oneline c3 v3 commit b2 v2 commit a1 v1 commit Now revert the latest commit: git revert c3 📍 New log: d4 Revert "v3 commit" c3 v3 commit b2 v2 commit a1 v1 commit ✅ A new commit is created ✅ History is preserved ✅ Safe for production & team environments 🔹 2️⃣ Git Reset – History Rewriting (Use Carefully) 👉 git reset is used to move the branch pointer backward 📌 What it does: Removes commits from history No new commit is created Can rewrite history (dangerous in shared branches) 📍 Example: git reset --hard b2 📍 New log: b2 v2 commit a1 v1 commit ❌ v3 commit is completely removed ❌ No trace of undo action ⚠️ Risky if code is already pushed 🔥 Key Difference ✔️ git revert → Safe, creates a new commit, keeps history ⚠️ git reset → Dangerous, deletes history, no new commit 💡 Pro Tip (MNC Level Practice): Use git revert in production or shared branches Use git reset only for local changes or before pushing 📌 Understanding this difference can save your team from major production issues. #HiteshDevOps #DevOps #Git #GitHub #CI_CD #Docker #Kubernetes #AWS #OpenToWork #HiringDevOps #DevOpsEngineer #TechHiring #LearningInPublic #BuildInPublic #TechJourney
To view or add a comment, sign in
-
-
💻 Git Workflow Wins: The Lifeline of DevOps Ever spent hours debugging because someone merged directly into main? I’ve been there, and that’s why a clean Git workflow is non-negotiable for any DevOps or SRE professional. Here’s the golden rule I follow: 1️⃣ Feature Branches First – Always create a separate branch for new features or fixes. Keep your main branch stable. 2️⃣ Pull Request Reviews – Never skip PR reviews. Another set of eyes can catch mistakes early. 3️⃣ CI/CD Checks Before Merge – Automated pipelines (GitHub Actions, GitLab CI, or Jenkins) ensure your code doesn’t break production. 💡 Pro Tip: Automate branch naming conventions using pre-commit hooks. It reduces confusion, keeps repos clean, and saves time during code reviews. In the image above, you’ll see the workflow I use daily: Feature Branch → Pull Request → CI → Merge to Main ✅ This simple but disciplined workflow ensures: Stable production branches Fewer merge conflicts Faster, safer deployments Improved collaboration across teams Whether you’re a developer, DevOps engineer, or SRE, mastering Git workflows is key to efficient, error-free releases. How do you manage your Git workflow? Any hidden tips or tricks that make your life easier? Let’s share best practices! 👇 #DevOps #Git #CI_CD #Automation #SRE #CodingLife #VersionControl #SoftwareEngineering #DevOpsCulture
To view or add a comment, sign in
-
-
Day 7/90: A Full Week of DevOps – Merging, Conflicts, and Strategy! 🚀🔥 One week down, consistency maintained! Today’s session with HeyDevops and Praveen Singampalli was a deep dive into the reality of team collaboration: what happens when code and ideas collide. Key Learnings from Day 7: Git Fetch vs. Git Pull: 📥 Learned the critical difference. git fetch is like a "preview mode"—it downloads new data from a remote repo so you can see it without it affecting your current working files. git pull, on the other hand, downloads AND integrates that data immediately. The Dreaded "Merge Conflict": ⚠️ I learned that a conflict happens when two people edit the same lines of the same file in different branches of the same repo. Git stops the merge and asks us to decide which code stays. It's not an error; it's a safety feature! Branching Strategies (The Roadmap): 🌿 We explored how professional teams organize their work: Feature Branching: Keeping every new feature in its own isolated branch until it’s tested and validated. Task Branching: Implementing specific tasks on separate branches to keep the workflow clean. Release Branching: Creating a dedicated space to finalize a new release cycle where only bug fixes are allowed—no new features! Pro Commands: 🛠️ Mastered git merge --abort to safely back out of a messy conflict, and git stash to temporarily "hide" my uncommitted changes so I can switch tasks quickly without losing work. My Takeaway: Managing a codebase isn't just about writing code; it's about managing people and their contributions. These branching strategies are what keep massive projects from turning into chaos. #DevOps #Git #SoftwareEngineering #CareerTransition #LearningInPublic #HeyDevOps #PraveenSingampalli #Consistency
To view or add a comment, sign in
-
🚀 Git Branching Strategies — Managing Code the Right Way As applications grow, managing code changes efficiently becomes critical. This is where Git branching strategies play a key role. Branching allows teams to work on multiple features, fixes, and releases without impacting the main codebase. 🔹 Why branching matters: ✔ Enables parallel development ✔ Keeps the main branch stable ✔ Reduces conflicts during collaboration ✔ Supports structured release management 🔹 Common Branching Strategies: 🔸 Feature Branching Each new feature is developed in a separate branch and merged after completion 🔸 Git Flow Uses dedicated branches like main, develop, feature, release, and hotfix 🔸 Trunk-Based Development Developers commit frequently to a single main branch with short-lived branches 🔹 How it works in practice: Developers create branches for features or bug fixes Changes are tested and reviewed through pull requests Code is merged into the main branch after validation 💡 Key Insight: A well-defined branching strategy improves team collaboration, code quality, and release stability in DevOps workflows. #DevOps #Git #BranchingStrategy #CICD #AWS #Azure #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 #100DaysOfDevOps – Day 7 Today I explored advanced Git operations for commit history management and recovery, focusing on real-time development and troubleshooting scenarios. 🔹 Git Log (History Analysis) Used to track changes and understand commit history. ✔ Scenario: Debugging issues by identifying recent changes ✔ Scenario: Tracking who made specific changes in the codebase Commands: git log --oneline git log -3 git log --graph --oneline --all 🔹 Git Amend (Modify Last Commit) Used to update the most recent commit. ✔ Scenario: Fixing incorrect commit messages ✔ Scenario: Adding missed changes to the latest commit Commands: git commit --amend -m "message" git commit --amend --no-edit 🔹 Git Reset (Undo Changes) Used to move back to previous commits. ✔ Scenario: Removing unwanted commits before pushing to remote ✔ Scenario: Fixing mistakes in local commits Commands: git reset --soft HEAD~1 git reset --hard HEAD~1 🔹 Git Revert (Safe Undo) Used to undo changes without deleting history. ✔ Scenario: Reverting production issues safely ✔ Scenario: Maintaining audit/history while fixing bugs Command: git revert <commit-id> 🔹 Git Ignore (.gitignore) Used to exclude unnecessary files from tracking. ✔ Scenario: Ignoring log files, build artifacts, secrets ✔ Scenario: Preventing unwanted files from being pushed to repo 💡 Understanding these commands is crucial for code recovery, debugging, and maintaining clean commit history in real DevOps workflows. Not just writing code — managing its history effectively. 💪 #Git #DevOps #VersionControl #CloudEngineering #100DaysChallenge #ContinuousLearning
To view or add a comment, sign in
-
-
🚀 Day 12 – DevOps 100 Days Challenge 🚀 Today’s focus was on understanding advanced Git workflows and how to manage code changes efficiently in real‑world and team‑based environments. 📌 What I learned today in Git: Git Merge – integrating changes from one branch into another while preserving commit history Git Rebase – rewriting commit history to achieve a clean, linear timeline Merge vs Rebase When to use merge to preserve full branch history When to use rebase for a cleaner and more readable commit history Git Stash – temporarily saving uncommitted changes without committing them Git Tag – marking important points in history like releases and versions These concepts are essential for maintaining clean repositories, handling work‑in‑progress safely, and collaborating effectively in DevOps and CI/CD workflows. 🌿🔀 Another step forward in strengthening my Git and version control skills. Moving ahead to Day 13 🚀💪 #DevOps #100DaysOfDevOps #Git #GitMerge #GitRebase #GitStash #GitTag #MergeVsRebase #VersionControl #LearningJourney #ContinuousLearning
To view or add a comment, sign in
-
🚀 GitHub for DevOps – Day 4 (Part 1) 🔥 Git Reset — The Most Misunderstood Command in Git As a DevOps Engineer, you’re not just writing code — you’re managing history, fixing mistakes, and maintaining clean repositories. 👉 That’s where git reset becomes powerful. 📌 Simple Meaning: Git reset = Move your project back to a previous commit Example: A → B → C → D Want to go back to B? 👉 git reset B ⚙️ Git Works in 3 Areas (Must Know) 1️⃣ Working Directory → Your files 2️⃣ Staging Area → git add 3️⃣ Repository → commits 🔥 Types of Git Reset 🔹 1. Soft Reset (Safe) 👉 git reset --soft HEAD~1 ✔ Commit removed ✔ Changes still in staging 💡 Use when: You want to fix commit message or recombine commits 🔹 2. Mixed Reset (Default) 👉 git reset HEAD~1 ✔ Commit removed ✔ Staging cleared ✔ Changes still in files 💡 Use when: You added wrong files 🔹 3. Hard Reset (Dangerous ⚠️) 👉 git reset --hard HEAD~1 ❌ Commit removed ❌ Staging removed ❌ Changes deleted permanently 💡 Use when: You want to completely discard changes 📍 When to Use? ✔ Fix wrong commit → soft reset ✔ Remove staged files → mixed reset ✔ Delete everything → hard reset 🚨 Golden Rule 👉 Use git reset only in local branches 👉 Avoid using it on shared/main branches 💬 Real DevOps work is not about tools It’s about controlling changes safely and confidently. #HiteshDevOps #DevOps #Git #GitHub #CI_CD #Docker #Kubernetes #AWS #OpenToWork #HiringDevOps #DevOpsEngineer #TechHiring #LearningInPublic #BuildInPublic #TechJourney
To view or add a comment, sign in
-
-
🚀 Git for DevOps – Day 3 (Part 1) ⚡ Master These Git Concepts or You’ll Struggle in Real Projects In real DevOps work, Git is not just about commits and push. You must know how to manage changes safely — especially when switching branches. Let’s break down 3 important concepts every DevOps Engineer should know 👇 📌 1 .gitignore – Keep Your Repo Clean .gitignore is a file that tells Git what NOT to track or upload. By default: 👉 git add . tracks everything But in real projects, you should never push: 🔐 Passwords / secrets 📄 Logs 📂 Temporary files ⚙️ Build artifacts 👉 .gitignore helps you protect sensitive data + keep repo clean 📌 2. git stash – Save Work Temporarily Sometimes you are in the middle of work… and suddenly you need to switch branches. But Git blocks you with this error: Your local changes would be overwritten by checkout 💡 Solution: git stash 👉 What it does: Saves your changes (hidden) Cleans your working directory 👉 Command: git stash 👉 Use cases: Switching branches Urgent bug fix Temporary save without commit ⚠️ Important: Stash is temporary, not a backup. 📌 3. git stash pop – Bring Back Your Work After switching branches and coming back… 👉 Use: git stash pop 👉 What happens: Restores your saved changes Removes them from stash 💡 Simple understanding: git stash → Save & hide changes git stash pop → Restore & remove 🔥 Real-Time Scenario You are working in a repo (example: ollama) You modified a file like README.md Now you try to switch branch → ❌ ERROR 👉 Fix: git stash git checkout other-branch Later: git checkout original-branch git stash pop ✅ Your work is back safely 💡 Final Tip If you don’t want to lose work: 👉 Use git stash smartly 👉 But don’t depend on it as long-term storage 💬 In DevOps, speed matters… but safe workflow matters more Follow for more practical DevOps content 🚀 #Git #DevOps #Learning #VersionControl #Cloud #Jenkins #Kubernetes
To view or add a comment, sign in
-
Explore related topics
- DevOps Principles and Practices
- Using Version Control For Clean Code Management
- How to Use Git for IT Professionals
- How to Use Git for Version Control
- GitHub Code Review Workflow Best Practices
- DevOps Engineer Core Skills Guide
- Tips for Continuous Improvement in DevOps Practices
- Key Skills for a DEVOPS Career
- How to Optimize DEVOPS Processes
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development