BM: Baca dalam Bahasa Melayu
World 3: Parallel Universes · Boss challenge
Conflict Crusher
You will learn: to crush three conflicts and leave one clean history.
The problem
Party mode meets your diary. Three conflicts! Then a messy branch to tidy. Ready to crush them all?
Watch
Two files, three clashes. Read each one. Choose what stays. Mistakes are free, so experiment!
Try it
Crush all three conflicts. Title: keep yours. Day 5: keep both. Colour: keep theirs.
Pick what stays in each conflict. Then finish.
Conflicts left: 3 of 3
index.html
<<<<<<< HEAD (conflict marker)<h1>My Git Diary</h1>======= (conflict marker)<h1>Party Diary</h1>>>>>>>> party (conflict marker)<p>Day 1: I learned Git.</p> <p>Day 2: I learned branches.</p> <p>Day 3: I learned merging.</p> <p>Day 4: I learned rebase.</p>
<<<<<<< HEAD (conflict marker)<p>Day 5: I fixed conflicts.</p>======= (conflict marker)<p>Day 5: Party time!</p>>>>>>>> party (conflict marker)Hint
index.html has two conflicts. style.css has one. Use the file tabs.Check
Halfway through, you panic. Which command puts everything back to before the merge?
Pick one answer.
Try it
Four quick drills in the terminal. Each one starts fresh.
Step 1 of 4: Urgent switch
Dark mode is half done. Put it aside and go to main.
- Empty
- 4 save points
- Start dark mode
- Add style
- Add day 1 page
Hint
Stuck?git status and git branch tell you where you are.Try it
Last one: the recipes branch. Fix up “oops” into the page. Rename “add cake” to “Add cake recipe”. Drop “temp debug”.
Each card is one commit. Pick an action. Drag the grip or use the arrows to reorder.
Top = oldest. Git replays the cards from the top down.
c276142Add recipes pagekeep it5cc4c34oopskeep it3646b92add cakekeep itf0886f8temp debugkeep it51b0794Add pancake recipekeep it
Hint
fixup, reword, drop: one word per card.Check
You already shared the recipes branch. Mei built on it. Can you still tidy it with git rebase -i?
Pick one answer.
You did it!
You can now crush conflicts and keep your history clean.
Bahasa Melayu
Mod parti bertemu diari anda. Tiga konflik! Kemudian satu branch bersepah untuk dikemas. Sedia untuk tumpaskan semuanya?
Dua fail, tiga pertembungan. Baca setiap satu. Pilih apa yang kekal. Silap tak apa, jadi cuba-cubalah!
Tumpaskan ketiga-tiga konflik. Tajuk: kekalkan milik anda. Hari 5: kekalkan kedua-dua. Warna: kekalkan milik mereka.
Separuh jalan, anda panik. Arahan mana yang kembalikan semuanya macam sebelum merge?
Empat latihan pantas dalam terminal. Setiap satu bermula semula.
git status dan git branch beritahu di mana anda berada.Yang terakhir: branch recipes. Fixup “oops” ke dalam halaman itu. Tukar nama “add cake” jadi “Add cake recipe”. Drop “temp debug”.
Anda dah kongsi branch recipes. Mei bina di atasnya. Bolehkah anda masih kemaskannya dengan git rebase -i?
Kini anda boleh tumpaskan konflik dan jaga sejarah supaya kemas.
You finished this before. Practice is always welcome!
Official docs: git merge · git rebase · git stash · git cherry-pick · git branch
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?