BM: Baca dalam Bahasa Melayu
World 3: Parallel Universes
Read conflict markers
You will learn: why a merge stops, and how to read Git's conflict markers.
The problem
You merge cake into main, and Git stops. CONFLICT! Did you break your diary?
Watch
Nothing broke. Both branches wrote a different day 2 on the same line. That’s a conflict: Two changes hit the same spot. You pick what stays.. Git can’t guess, so it asks you.
Watch
Git wrote both versions into the file. conflict markers: The lines <<<<<<<, ======= and >>>>>>> that Git puts around a clash. fence them in. Your line sits on top. Theirs sits below.
Try it
Find the fences.
Tap the three marker lines.
0 of 3 found
Hint
They start with seven<, seven = or seven >.Predict
Which day 2 line came from your branch, main?
Pick one answer.
Check
Lost mid-merge? Run git status. It lists the files to fix as both modified. It even names your next steps.
You did it!
You can now read conflict markers without panic.
Go deeper (optional)
During a conflict, git diff shows both sides at once. Want to see the line before either change? Run git config --global merge.conflictStyle diff3. Then a part starting with ||||||| shows the old base line.
Bahasa Melayu
Anda merge cake ke main, dan Git berhenti. CONFLICT! Adakah anda dah rosakkan diari?
Tiada apa yang rosak. Kedua-dua branch tulis hari 2 yang berbeza pada baris sama. Itulah konflik. Git tak boleh teka, jadi ia tanya anda.
Git tulis kedua-dua versi ke dalam fail. Penanda konflik memagarinya. Baris anda di atas. Baris mereka di bawah.
Cari pagarnya.
<, tujuh = atau tujuh >.Baris hari 2 mana yang datang dari branch anda, main?
Keliru di tengah merge? Jalankan git status. Ia senaraikan fail yang perlu dibaiki sebagai both modified. Ia siap beritahu langkah seterusnya.
Kini anda boleh baca penanda konflik tanpa panik.
You finished this before. Practice is always welcome!
Official docs: git merge: how conflicts are presented · git status
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?