A Git feature I wish I discovered earlier: git worktree. Normally, if you want to work on another branch you have to: • stash your changes • commit unfinished work • or switch branches and risk conflicts git worktree lets you open another branch in a separate folder, while keeping your current work untouched. Example: git worktree add ../feature-login feature-login Git creates a new directory with that branch checked out. Now you can: • keep working on your current branch • test another branch at the same time • run two versions of the project simultaneously Very useful when reviewing PRs, fixing hotfixes, or testing features. Surprisingly, many developers still don’t know this exists. #git #developers #softwareengineering
Git Worktree Simplifies Branch Management
More Relevant Posts
-
Today I was working on a project and accidentally committed changes to the wrong branch 😅. For a moment I thought I had created a mess in the repo... Then I found this lifesaver Git command: git cherry-pick. "git cherry-pick" lets you take a specific commit from one branch and apply it to another branch. Instead of merging entire branches or manually copying changes, you can pick the exact commit you need and bring it into the current branch. For example, if a commit was made in the wrong branch, you can switch to the correct branch and run: git cherry-pick <commit-hash> Git will apply the changes from that commit to your current branch as a new commit. So instead of reverting things, rewriting history, or redoing the work, you can simply move the exact changes where it belongs. One small command. Huge headache avoided. If you use Git and haven't used "git cherry-pick" yet, keep it in your toolbox. It can save you when commits land in the wrong branch. #Git #GitTips #SoftwareDevelopment
To view or add a comment, sign in
-
-
You merged 10 commits into main — but only ONE of them needs to go to production. Right now. 🚨 Most developers at this point either panic-merge the whole branch or manually copy-paste code like it's 2005. There's a better way. It's called git cherry-pick — and it's one of the most underused Git commands out there. git cherry-pick <commit-hash> That one line copies a specific commit from any branch and applies it exactly where you need it. No extra baggage. No messy merges. Here's when it actually saves you: 🔥 A critical hotfix lives on a feature branch — cherry-pick it straight to main without merging 2 weeks of unfinished work. 🚀 You need the same bug fix on both v1 and v2 of your app — cherry-pick once per branch, done. 📦 A teammate built one utility function you need right now — grab just that commit, not their entire branch. Why do developers ignore it? Honestly, because it sounds scary. "What if I mess up the history?" — but when you understand it, it's one of the safest, most surgical tools in your Git toolkit. Have you ever used cherry-pick in a real incident or hotfix situation? Share your story below 👇 — I'd love to hear how you handled it. #Git #SoftwareEngineering #DevTips
To view or add a comment, sign in
-
Great code means nothing if you can't push it safely. 💻 If you still rely on git push --force or panic during a merge conflict, you aren't ready for a professional dev team. Master version control without the dry terminal manuals. "বাংলায় গিট ও গিটহাব" teaches Git the way humans actually learn: through stories. Follow Seherish and Aranya through real-world projects, team collaboration scenarios, and step-by-step command execution. ✅ Story-based logic ✅ Real-world team workflows ✅ Step-by-step commands Stop guessing in the terminal. 👉 Order here: https://lnkd.in/guVm9-QE #Git #GitHub #SoftwareEngineering #GradLeap #DeveloperCommunity
To view or add a comment, sign in
-
-
🚀 Beyond the basic Git commands — here are a few powerful ones developers often overlook: Most of us start with: git add → commit → push But real-world development requires much more than that 👇 🔹 git stash Save work-in-progress and switch context without committing incomplete code 🔹 git reflog Recover “lost” commits — a lifesaver when things go wrong 🔹 git rebase Maintain a clean and readable commit history 🔹 git cherry-pick Apply specific commits across branches without merging everything 🔹 git bisect Debug issues faster using binary search across commits 💡 Key takeaway: The difference between writing code and working efficiently in a team often comes down to how well you use Git. Still refining my workflow and exploring more advanced Git practices as part of my backend development journey 🚀 #Git #SoftwareEngineering #BackendDevelopment #NodeJS #DeveloperGrowth
To view or add a comment, sign in
-
I once lost 3 days of work. Not because of a bug. Not because of a crash. Because of a simple: rm -rf on the wrong folder. That day, I understood why Git isn't optional. It's vital. But Git is more than a backup tool. It's a language of collaboration. Here's what every developer absolutely needs to master: 📌 The essential basics → git init → initialize a repo → git clone → copy an existing project → git add → stage your changes → git commit → save a state → git push / pull → sync with remote 🌿 Branches — your safety net → Never code directly on main → 1 feature = 1 branch → git checkout -b my-feature → Merge only when it's stable ⚡ Commands that save lives → git stash → set aside without committing → git log → see the full history → git diff → see exactly what changed → git revert → undo without erasing history → git reset → travel back in time 🚨 Mistakes EVERYONE makes: → Committing directly to main → Writing "fix" as a commit message → Never using branches → Pushing API keys into the repo 😱 A good commit message looks like: ✅ "feat: add QR code validation on ticket scan" ❌ "fix stuff" ❌ "wip" ❌ "aaaaaa" Git doesn't just save your code. Git saves your reasoning. Every commit = a documented decision. Treat your Git history the way you treat your code: with care and intention. 🧠 💬 What's the Git command that once saved your life? #GentilMaliyamungu #GentilLeNoiR #GentilDeveloper #Programming #Git #CodeLife #WebDevelopment #Tech #Developer #SoftwareEngineering #LearnToCode #100DaysOfCode #Africa #Backend #Frontend #DevTools
To view or add a comment, sign in
-
-
I once lost 3 days of work. Not because of a bug. Not because of a crash. Because of a simple: rm -rf on the wrong folder. That day, I understood why Git isn't optional. It's vital. But Git is more than a backup tool. It's a language of collaboration. Here's what every developer absolutely needs to master: 📌 The essential basics → git init → initialize a repo → git clone → copy an existing project → git add → stage your changes → git commit → save a state → git push / pull → sync with remote 🌿 Branches — your safety net → Never code directly on main → 1 feature = 1 branch → git checkout -b my-feature → Merge only when it's stable ⚡ Commands that save lives → git stash → set aside without committing → git log → see the full history → git diff → see exactly what changed → git revert → undo without erasing history → git reset → travel back in time 🚨 Mistakes EVERYONE makes: → Committing directly to main → Writing "fix" as a commit message → Never using branches → Pushing API keys into the repo 😱 A good commit message looks like: ✅ "feat: add QR code validation on ticket scan" ❌ "fix stuff" ❌ "wip" ❌ "aaaaaa" Git doesn't just save your code. Git saves your reasoning. Every commit = a documented decision. Treat your Git history the way you treat your code: with care and intention. 🧠 💬 What's the Git command that once saved your life? #GentilMaliyamungu #GentilLeNoiR #GentilDeveloper #Programming #Git #CodeLife #WebDevelopment #Tech #Developer #SoftwareEngineering #LearnToCode #100DaysOfCode #Africa #Backend #Frontend #DevTools
To view or add a comment, sign in
-
-
Git Branching Why did the developer break up with Git Flow? Because every time they tried to make a small change, they ended up in a 5-branch commit romance with `main`, `develop`, `feature`, `release`, and `hotfix` — and still got a merge conflict at the dinner table. Meanwhile, Trunk-Based was waiting outside with a single branch and a simple `git push`, saying: “It’s not perfect… but at least I commit.” No ‘perfect’ strategy. Just the one that doesn’t ghost you during a hotfix at 11 PM. #Git #BranchingStrategies #DevHumor #TechJokes #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 𝙎𝙩𝙤𝙥 𝙡𝙤𝙨𝙞𝙣𝙜 𝙬𝙤𝙧𝙠. 𝙎𝙩𝙖𝙧𝙩 𝙨𝙩𝙖𝙨𝙝𝙞𝙣𝙜 𝙞𝙩. Ever been in the middle of a feature when your lead says, "Hey, fix this urgent bug NOW"? Most devs either commit half-baked code. There's a better way - git stash. What git stash does for you: 🔀 𝗠𝗶𝗴𝗿𝗮𝘁𝗲 𝗯𝗲𝘁𝘄𝗲𝗲𝗻 𝗯𝗿𝗮𝗻𝗰𝗵𝗲𝘀 𝗳𝗿𝗲𝗲𝗹𝘆 — Save your work-in-progress instantly and switch branches without a single lost line. Come back anytime, pick up right where you left off. 📜 𝗞𝗲𝗲𝗽 𝗮 𝗰𝗹𝗲𝗮𝗻 𝗰𝗼𝗺𝗺𝗶𝘁 𝗵𝗶𝘀𝘁𝗼𝗿𝘆 — No more "WIP", "temp", or "fix fix fix" commits polluting your log. Stash keeps your half-done work off the timeline until it's ready. 👥 𝗪𝗼𝗿𝗸 𝘀𝗺𝗼𝗼𝘁𝗵𝗹𝘆 𝗶𝗻 𝘀𝗵𝗮𝗿𝗲𝗱 𝗯𝗿𝗮𝗻𝗰𝗵𝗲𝘀 — Multiple devs on the same branch? Stash your changes -> pull latest -> apply back. Zero conflicts, zero drama. The commands you'll actually use: git stash -> save everything git stash pop -> restore & remove from stash git stash list -> see all stashes git stash apply stash@{1} -> pick a specific one git stash drop -> clean up old stashes "Commit to clarity. Stash the chaos." #git #devtips #programming #100DaysOfCode #learning
To view or add a comment, sign in
-
-
Headline: The Git command that saves my Monday (and my sanity) 🛠️ We’ve all been there: You start working on a new feature, get 20 minutes into the code, and suddenly realize you’re on the main branch instead of a new feature branch. 🤦♂️ Before you panic or manually copy-paste your changes elsewhere, remember this command: git stash Why it’s a lifesaver: The Problem: You have uncommitted changes but need to switch branches immediately. The Solution: Stashing takes your dirty working directory (your modified tracked files and staged changes) and saves it on a stack of unfinished changes that you can reapply at any time. My typical workflow: git stash (Tuck those changes away safely) git checkout -b feature/new-awesome-idea (Switch to the right branch) git stash pop (Bring those changes right back where they belong) It’s simple, effective, and keeps the commit history clean. What’s your most-used "utility" Git command? Let’s swap tips in the comments! #Git #VersionControl #WebDevelopment #SoftwareEngineering #CodingTips #MondayMotivation
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