Skip to main content

Git Worktree Trick: Merge Without Checkout! πŸͺ„

Β· 12 min read
Mahmut Salman
Software Developer

The Problem πŸ˜•β€‹

Backend Dev: "I want to merge my frontend branch into main, but when I try git checkout main, Git says 'fatal: main is already checked out at ../EcommerceWebsite3-backend'. I can't checkout main because it's being used in my backend worktree!"

Frontend Mentor: "Ah! This is a perfect situation to use one of Git's hidden superpowers - pushing to a local branch without checking it out!"

Git Rebase Logic: Why Can't I Just Merge? πŸ€”

Β· 17 min read
Mahmut Salman
Software Developer

The Confusion πŸ˜•β€‹

Backend Dev: "I'm looking at my Git history and I see that frontend branch has 13 commits that aren't on main, and main has 1 commit that frontend doesn't have. My mentor says I need to rebase. But... why? Why can't I just merge?"

Frontend Mentor: "Excellent question! This is where understanding the LOGIC of rebase becomes crucial. Let me show you exactly why rebase is necessary in this situation."

Git Worktree Magic: Do Commits Show Up in Other Worktrees? πŸͺ„

Β· 10 min read
Mahmut Salman
Software Developer

The Confusion πŸ˜•β€‹

Backend Dev: "I have two worktrees - one for frontend and one for backend. When I commit in the backend worktree, does it show up in the original worktree? And when I merge backend into main, what happens to the backend branch?"

Frontend Mentor: "Great question! This is where Git worktrees become really magical. Let me show you exactly what's happening in your setup."

Git Rebase's Two-Phase Mystery: Why Isn't It Just a Merge? πŸ€”

Β· 6 min read
Mahmut Salman
Software Developer

The Confusion πŸ˜•β€‹

Backend Dev: "I don't understand why we have Phase 2 in rebasing. I thought it would be as simple as running a merge command. But in rebase, I think we do merge command too? Why the extra step?"

Frontend Mentor: "Ah! This is one of the most common confusions about Git rebase. Let me show you what's really happening under the hood."

Why Can't I Just Use Regular Variables? Understanding useState's Magic

Β· 13 min read
Mahmut Salman
Software Developer

I'm a backend developer learning React, and I'm confused. Why do I need useState when I can just create my own setEmail function like we do in Java? πŸ€” Just set the variable and done! My frontend mentor showed me what happens when you try thisβ€”and why React's useState is actually solving a critical problem I didn't even know existed. This conversation revealed the beautiful machinery working behind React's scenes.

Wait, Does 'await' Make My Code Synchronous? Understanding Async/Await's Double Nature

Β· 12 min read
Mahmut Salman
Software Developer

I'm a backend developer learning frontend, and I just encountered something confusing. I use await login({ email, password }) and my code waits for the response before continuingβ€”isn't that synchronous? πŸ€” But the method is marked async, so it's asynchronous? My frontend mentor explained the beautiful double nature of async/await: it makes code look synchronous inside the function but stay asynchronous to the outside world. This conversation finally made async/await click for me.

I Only Added w-full, Why Is My Button Text Centered? Understanding Browser Defaults

Β· 11 min read
Mahmut Salman
Software Developer

I'm learning frontend development, and something weird just happened. I added only w-full to my button, and the text "Click me" became centered horizontally! πŸ€” I didn't add any text-centering classes. My frontend mentor revealed something I never knew: browsers have default styles that help us without us even knowing. This conversation opened my eyes to the invisible CSS working behind the scenes.

Wait, My Buttons Are Still Side-by-Side Without Flex? Understanding inline-block vs Flexbox

Β· 13 min read
Mahmut Salman
Software Developer

I removed flex from my button container, expecting them to stack vertically, but they're still sitting side-by-side! 🀨 I thought flex was what made them horizontal. My frontend mentor corrected my misunderstanding: buttons are inline-block by default, which means they naturally sit beside each other. This conversation taught me the crucial difference between "happens to be side-by-side" and "controlled side-by-side layout."

Wait, Why Does My Width Stay 384px But Height Changes? Understanding the CSS Box Model

Β· 9 min read
Mahmut Salman
Software Developer

I'm a backend developer learning frontend, and I just noticed something weird in Firefox Inspector. I removed p-8 from my div, and the height changed from 124px to 60pxβ€”but the width stayed at 384px! πŸ€” My frontend mentor explained the CSS Box Model and why w-96 behaves differently from h-auto. This conversation finally made the box model click for me.