BM: Baca dalam Bahasa Melayu
World 3: Parallel Universes
Merge or rebase? Plus cherry-pick
You will learn: when to merge, when to rebase, and how to copy just one commit.
The problem
Two ways to bring about into main: merge or rebase. Your team argues about it. Who wins?
Watch
Rebase makes new copies. The old commits live on with anyone who has them. Two versions! So never rebase commits others already have. That’s the golden rule of rebase: Never rebase commits that other people already have..
Try it
Which one does this?
Drag a card into a box. Or tap the card, then tap the box.
Predict
You shared about yesterday. Aina built on it today. Should you rebase about now?
Pick one answer.
Watch
Sometimes you need just one commit. git cherry-pick copies one commit onto your branch. One cherry, not the whole tree. That’s a cherry-pick: Copy one commit from another branch onto yours..
Try it
Copy only the useful fix from experiments onto main.
Tap the commit to copy onto main.
Check
Good use of cherry-pick, or not?
Swipe right for good, left for needs work. Or use the buttons.
Copy one bug fix to an older release branch
You did it!
You can now choose merge or rebase, and copy one commit.
Go deeper (optional)
Many teams rebase their own branch, then merge it. Both are fine with the golden rule. git cherry-pick -x adds a line saying where the copy came from. A clash? Fix the file, git add, then git cherry-pick --continue. Or git cherry-pick --abort.
Bahasa Melayu
Dua cara bawa about masuk ke main: merge atau rebase. Pasukan anda bertekak. Siapa menang?
Rebase buat salinan baru. Commit lama kekal pada sesiapa yang memilikinya. Dua versi! Jadi jangan rebase commit yang orang lain dah ada. Itulah peraturan emas.
Yang mana buat perkara ini?
Anda dah kongsi about semalam. Aina bina di atasnya hari ini. Patutkah anda rebase about sekarang?
Kadang-kadang anda cuma perlu satu commit. git cherry-pick salin satu commit ke branch anda. Petik satu ceri, bukan seluruh pokok. Itulah cherry-pick.
Salin pembaikan yang berguna sahaja dari experiments ke main.
Penggunaan cherry-pick yang bagus, atau tidak?
Kini anda boleh pilih merge atau rebase, dan salin satu commit.
You finished this before. Practice is always welcome!
Official docs: git rebase: recovering from upstream rebase · git cherry-pick · git merge
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?