💡 Day 31 of #100DaysOfDevOps — Understanding Git Stash Sometimes, in the middle of writing code, we need to switch branches or pull the latest updates — but we’re not ready to commit half-done work. That’s where Git Stash becomes a lifesaver. Git stash allows you to temporarily save your uncommitted changes so you can return to them later without losing progress. Here’s a quick breakdown 👇 🧩 Common Git Stash Commands: git stash → Save your current changes git stash push -m "message" → Save changes with a note git stash list → View all stashes git stash apply stash@{1} → Restore a specific stash git stash drop stash@{1} → Delete a specific stash git stash clear → Clear all stashed changes Today’s task involved restoring stashed changes from stash@{1}, committing, and pushing them to origin — a great way to understand how developers can pause and resume work safely. ⚙️ Why it matters: In real DevOps workflows, context switching happens often. Git Stash ensures your work is never lost, and your workspace stays clean while collaborating across branches or handling hotfixes. #Git #DevOps #100DaysOfDevOps #KodeKloud
"Mastering Git Stash for Safe Context Switching"
More Relevant Posts
-
Day 30 of #100DaysOfDevOps — Resetting Git History Like a Pro Ever looked at your Git history and thought, “This needs a cleanup”? Today’s challenge was all about rewriting Git history — specifically, resetting a repo to an earlier commit and cleaning it up to only keep the important ones. Key Concepts Learned: git reset --hard <commit-hash> — moves your branch pointer to a specific commit and discards everything after it. git rebase -i --root — interactively lets you rewrite or squash commits starting from the very first one. git push --force — updates the remote repo to reflect your cleaned-up local history. In real-world DevOps or software teams, this comes in handy when: You need to tidy up messy test commits before merging to main. You accidentally pushed experimental changes and want to reset. You want a clear, minimal commit history for better traceability. I hit some errors (like unpacker and fast-forward issues), but after understanding how Git manages refs and remote histories, I used the proper reset → rebase → force-push flow. It worked fine. Tip: Use git log --oneline often to visualize your history, and always think twice before using --force 😉 Tomorrow continues the #Git series — and we'll be done this week. #KodeKloud #Git #100DaysOfDevOps
To view or add a comment, sign in
-
Day 35 of #100DaysOfDevOps — Wrapping Up Git with Git Hooks! Today marked the final Git lesson in my DevOps journey so far — and it was all about Git Hooks What I did: Merged a feature branch into the master branch Created a post-update hook that automatically creates a release tag (e.g., release-2025-10-25) whenever changes are pushed to the master branch Tested the hook and verified the tag creation This was the perfect way to end the Git series — automating tasks at the repo level to ensure smooth CI/CD workflows Quick Recap of What I’ve Learned in Git So Far: ✅ Initializing and cloning repositories ✅ Staging, committing, and pushing changes ✅ Working with branches and merges ✅ Reverting and resetting commits ✅ Using stash to save temporary work ✅ Rebasing for a clean linear history ✅ Resolving merge conflicts ✅ Cherry-picking specific commits ✅ Setting up Git Hooks for automation Git has been a powerful foundation for version control and collaboration — next up, we dive into Docker, where we’ll start containerising applications! #100DaysOfDevOps #DevOps #KodeKloud
To view or add a comment, sign in
-
Day 32 of #100DaysOfDevOps — Git Rebase Simplified! Today’s focus was on Git Rebase — one of those commands that can look tricky but is incredibly powerful once you get it. What is Git Rebase? Rebasing simply means moving your branch’s commits to start from the latest version of another branch (usually master). This helps keep your commit history clean and linear, unlike merge, which keeps every branch divergence and adds a merge commit. Rebase vs Merge Merge --> Combines changes with a merge commit (preserves branch history). Rebase --> Rewrites history by placing your commits on top of another branch (no extra commit). Common Rebase Steps git checkout feature git rebase master # (fix conflicts if any) git rebase --continue git push origin feature --force Rules for Rebasing 1. Never rebase commits that others already pulled. 2. Always communicate before force-pushing. 3. Use rebase for cleaning up local history before merging to main. Rebasing isn’t just about rewriting commits — it’s about maintaining clarity and collaboration in your workflow. #Git #DevOps #100DaysOfDevOps #KodeKloud
To view or add a comment, sign in
-
-
🚀 Understanding the Staging Area in Git If you’ve ever worked with Git, you’ve probably come across the term **“staging area”** — but what exactly does it do? 🤔 Think of Git as a **three-step workflow**: 1. **Working Directory** – where you make changes to your files. 2. **Staging Area (Index)** – a middle ground where you prepare specific changes for your next commit. 3. **Repository** – where committed snapshots are stored permanently. 💡 **The staging area** acts like a “preview” zone. It lets you: * Review and control what changes go into your next commit. * Commit only part of your edits instead of *everything* you’ve modified. * Keep your history clean and meaningful. Example: git add file1.js # Moves changes to the staging area git status # Shows what's staged and what's not git commit -m "Fix login bug" # Commits only the staged changes In short — the staging area gives you **precision and flexibility**. Instead of saving every change, you decide exactly what story your next commit tells. 📖 How do *you* use the staging area in your Git workflow? Do you commit often, or batch your changes? #Git #VersionControl #SoftwareDevelopment #DevOps #CodingTips #GitBasics
To view or add a comment, sign in
-
Just ran into a neat workflow solution for Docker builds in Git repos. Have you ever wanted to build an image from your code but only include committed changes? Stashing changes works, but there's a cleaner way. Git worktrees are brilliant for this. You can create a separate worktree from your committed code while keeping your current branch untouched. No need to stash, commit, or revert - just build directly from the committed version. This has saved me from more than one "oops, didn't mean to include those debug prints" moment in CI/CD pipelines. What's cool is how it solves a subtle but important problem: the mental load of managing temporary changes. As a full-stack developer, anything that reduces context switching helps me stay in the flow. It's these small workflow tweaks that add up to significant productivity gains over time. If you're building Docker images from Git repos, definitely give this approach a try. Clean builds, less mental overhead, and fewer surprises in production. #Docker #Git #DevOps #Productivity #FullStack
To view or add a comment, sign in
-
🚀 **Day 60: Git Command Mastery Series** Ever wondered how to create those clean, professional commit histories? Today's spotlight: **Squash Merging** 🎯 ## The Command That Changes Everything: ```bash git reset --soft main && git commit ``` ## What's Actually Happening? 🤔 This powerful combo resets your branch to match `main` while keeping ALL your changes staged and ready. It's like having a time machine that preserves your work but gives you a fresh start for your commit history! ## 💡 Pro Tip to Remember: Think "**Soft Reset = Soft Landing**" - Your changes land safely in staging while your commits disappear. The `&&` ensures you immediately commit everything as one clean package! 📦 ## Real-World Use Cases: **🔰 Beginner Level:** You made 15 small commits while learning a new feature. Before merging, clean it up: ```bash git reset --soft main && git commit -m "Add user authentication feature" ``` **⚡ Seasoned Professional #1:** Working on a complex feature with experimental commits, debugging commits, and fixes: ```bash git reset --soft main && git commit -m "feat: implement advanced caching layer with Redis integration" ``` **🏆 Seasoned Professional #2:** Before a production release, combining all hotfix commits into one traceable commit: ```bash git reset --soft main && git commit -m "hotfix: resolve critical payment gateway timeout issues" ``` ## Why This Matters: ✨ - Creates cleaner commit history - Makes code reviews more focused - Easier to track features and rollback if needed - Professional team collaboration standard Your future self (and your team) will thank you for this clean approach! 🙌 *What's your go-to strategy for maintaining clean Git history? Drop your thoughts below!* 👇 #Git #DevOps #SoftwareDevelopment #TechTips #VersionControl #CleanCode #GitWorkflow My YT channel Link: https://lnkd.in/d99x27ve
To view or add a comment, sign in
-
🔧 DevOps Guide: Common Git Errors & Solutions 🔧 Struggling with Git errors? Here's your troubleshooting guide to the most common Git challenges! 🚨 Top Git Errors & Quick Fixes: 1. Repository Issues: • "Not a git repository" → Solution: git init or check directory 2. Push/Pull Problems: • "Failed to push some refs" → Solution: git pull --rebase first 3. Merge Conflicts: • "Automatic merge failed" → Solution: Resolve conflicts manually, then commit 4. Authentication Errors: • "Permission denied" → Solution: Configure SSH keys or tokens 5. Branch Issues: • "Cannot delete branch" → Solution: Merge/push changes first 💡 Pro Tips: • Always pull before pushing • Keep branches up-to-date • Use SSH over HTTPS • Check git status frequently • Maintain clean working trees 🎯 Remember: Git errors are learning opportunities, not roadblocks! 💬 What's your most challenging Git error? Share below! #Git #GitHub #DevOps #TroubleShooting #DevOpsEngineering #GitCommands #SoftwareDevelopment #TechSupport #CodeManagement #VersionControl
To view or add a comment, sign in
-
🧠 “Git it right, or get lost in commits 😅” Every DevOps engineer has faced it — that “wait, which branch am I even on?” moment 😭 Let’s be honest — Git isn’t just a tool... it’s a superpower 💪 that can either save your project or break your sleep schedule 😂 Here’s a quick refresher from my Git cheatsheet (the one every DevOps engineer should keep pinned somewhere 👇): 🔹 git init — start fresh, new repo who dis 🔹 git add . — stage your chaos 🔹 git commit -m "fixed everything" — we all know that lie 😜 🔹 git branch — see your clones 🔹 git checkout -b feature/fix — your safe sandbox 🔹 git merge — where the real drama begins 🔹 git push origin main — the final move 🫡 🔹 git revert HEAD — your time machine back to sanity 🔹 git log --oneline — the story of your mistakes 😂 💡 Remember: “Git keeps your past, even when you try to forget it.” And that’s what makes it one of the most powerful tools in the DevOps world 🌍 So next time you hit git commit, do it with confidence — and maybe a little prayer 🙏 💬 Tell me in the comments: 👉 What’s the funniest or scariest Git command you’ve ever run? 👉 Ever had a git push -f moment that went horribly wrong? 👀 Let’s share some Git horror stories and lessons 😂👇 #Git #GitHub #DevOps #VersionControl #CICD #CloudEngineering #SoftwareDevelopment #CodingHumor #GitCommands #DevelopersLife #GitCheatSheet #GitTips #DevOpsEngineer #CloudNative #Automation #TechCommunity #CodeLife #SoftwareEngineering #LearningInPublic #DevOpsCommunity #PlatformEngineering #EngineeringExcellence #ProgrammingLife #GitOps #GitWorkflow #CloudComputing #DeveloperExperience #InfraAutomation #DevOpsTools #SourceControl #DevSecOps #Linux #GitBasics #CloudJourney
To view or add a comment, sign in
-
Day 28 of #100DaysOfDevOps — Understanding Git Cherry-Pick In collaborative projects, not every branch is ready for merging. Sometimes, you only need one specific change from another branch — that’s where git cherry-pick shines. What is Git Cherry-Pick? git cherry-pick allows you to apply a specific commit from one branch onto another without merging all the commits. This is especially helpful when: You want to move a hotfix or bug patch to the main branch. You only need a specific update from an experimental branch. You want to control exactly what goes into production. Basic Syntax: git checkout <target-branch> git log <source-branch> git cherry-pick <commit-hash> git push origin <target-branch> Example: git checkout master git log feature git cherry-pick abc1234 git push origin master As a DevOps engineer, understanding Git’s branching and commit management tools is essential for maintaining clean, stable, and traceable code releases. Cherry-picking ensures precision — you can promote tested fixes to production without merging incomplete features. I found this Medium post by Amir Mustafa helpful: https://lnkd.in/dNzH3n8W #Git #DevOps #100DaysOfDevOps #KodeKloud #VersionControl
To view or add a comment, sign in
-
-
✨ The GitLab Adventure: From Idea to Production ✨ Ever wondered what happens behind the scenes when a feature goes live? Let’s take a magical journey through GitLab! 🌟 📝 Step 1: The Spark It all begins with an Issue in GitLab. This is where ideas are born and documented—a tiny seed that will grow into something amazing. 🌿 Step 2: The Branching Path From that issue, we create a Feature Branch. Think of it as a secret trail where your code can roam free without disturbing the main road. 💻 Step 3: Crafting the Spell Now the real magic begins—writing code, committing changes, and pushing to your branch. GitLab CI/CD pipelines are like enchanted guardians, checking every spell you cast. 🔍 Step 4: The Council of Reviewers Open a Merge Request (MR) and invite the wise reviewers. They inspect your work, pipelines run their tests, and approvals unlock the next gate. 🧪 Step 5: The Dev Realm Your code enters the Dev environment, where it learns to play nicely with others. Early tests ensure harmony before the big stage. 🔗 Step 6: The SIT Trials Next stop: System Integration Testing. Here, your feature proves its worth among giants—integrating across systems without breaking a sweat. 🚢 Step 7: The Grand Release Finally, the gates to Production open! GitLab CI/CD deploys your creation to the real world, ready to delight users everywhere. ✨ From a tiny idea to a live feature, GitLab makes this journey smooth, collaborative, and magical. What’s your favorite part of this adventure? Drop your thoughts below! 👇 #GitLab #SDLC #DevOps #CI/CD #SoftwareEngineering #FeatureDevelopment #AutomationMagic #ContinuousIntegration #ContinuousDelivery #CodeReview #DeveloperLife #TechJourney #CloudDeployment #AgileDevelopment #CodingAdventure #InfrastructureEngineering #ReleaseManagement #BuildDeployRepeat #InnovationInTech
To view or add a comment, sign in
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