🔀 Merge & Conflict: Bring Changes Together Safely
Merge & Conflict: Bring Changes: A Git merge is like a court stenographer reconciling two witnesses' testimony of the same event: wherever their stories don't overlap, Git combin
A Git merge is like a court stenographer reconciling two witnesses' testimony of the same event: wherever their stories don't overlap, Git combines them automatically, but the moment two people changed the exact same line, it stops guessing and hands you the conflict markers instead. The thought-provoking question before you touch a single marker: if Git can auto-merge most of the time, why does it even bother stopping you for the rest? Because if it asked on every line, nobody would use branches at all — the whole point of parallel branches is that most changes don't actually collide, so the tool should only interrupt at the rare point a human decision is truly required. Java analogy: this is the same tension as two developers editing the same class in a shared IDE without a lock — a build tool can merge two developers' work automatically only when they touched different methods, never when they overrode the exact same method body, exactly like Git can only auto-merge non-overlapping lines. In real QA work this is precisely why a conflict resolved by quietly keeping the wrong line of an assertion is more dangerous than a build that fails loudly — a wrongly resolved marker can ship a test that passes for the wrong reason, and nobody notices until production.
3) Merge: bring main into your branch
Watch `origin/main` updates flow into a feature branch. The key idea: merge happens into the branch you are currently on.
4) Conflict resolution: markers are a decision point
Watch a conflict appear, read the markers, create the final file, run the test, mark it resolved, and continue the merge/rebase.
Sync main, then branch off
Why Does git pull --ff-only Prevent a "Surprise" Merge Commit?
Running git fetch origin…
Running git fetch origin ONLY updates the remote branch references (like origin/main) — NOT a single line of your local main branch CHANGES yet.
git switch main moves…
git switch main MOVES you to local main — subsequent commands now operate ON the main branch, your feature branch is UNAFFECTED.
git pull --ff-only origin main works ONLY…
git pull --ff-only origin main works ONLY when local main is EXACTLY BEHIND origin/main (with no commits of its own) — it just SLIDES the pointer FORWARD, it never CREATES a new merge commit.
If local main has its own commits…