BM: Baca dalam Bahasa Melayu
World 5: Teamwork
Merge, squash or rebase?
You will learn: the three ways to merge a pull request, and when to pick each.
The problem
Mei’s PR has 4 messy commits. A plain merge copies them all onto main. Then it adds a merge commit on top. Is that what you want?
Predict
This time you pick squash and merge: Merge a pull request as one single, tidy commit.. What lands on main?
Pick one answer.
Watch
Ravi’s commits are already neat. rebase and merge: Copy each commit of a pull request onto main, one by one, with no merge commit. copies each one onto main. No merge commit. History stays one straight line.
Try it
Back to Mei’s messy PR. Squash and merge it.
- Mmei
Adds the gallery page.
4 commits: wip, oops, fix typo, fix again
- Aina approved these changes
Lovely! Please squash those commits.
- Passed test
Hint
Under “How to merge”, pick “Squash and merge”. Then press “Merge pull request”.Check
Which merge method fits? Sort each one.
Drag a card into a box. Or tap the card, then tap the box.
Predict
A branch rule says: keep history in one straight line. Which method is blocked?
Pick one answer.
You did it!
You can now pick merge, squash or rebase for each pull request.
Go deeper (optional)
Rebase and merge makes new commits, with new hashes. Squash loses each small commit’s own message and author time. A repo can switch off the methods it does not want. With a merge queue, the queue picks the method for you.
Bahasa Melayu
PR Mei ada 4 commit (titik simpan) yang bersepah. Merge (cantum) biasa salin semuanya ke main. Kemudian ia tambah satu merge commit di atas. Itu ke yang anda mahu?
Kali ini anda pilih squash dan merge. Apa yang masuk ke main?
Commit Ravi dah kemas. Rebase dan merge salin setiap satu ke atas main. Tiada merge commit. Sejarah kekal satu garis lurus.
Kembali ke PR Mei yang bersepah. Squash dan merge PR itu.
Cara merge mana yang sesuai? Susun setiap satu.
Satu peraturan branch kata: simpan sejarah dalam satu garis lurus. Cara mana yang disekat?
Kini anda boleh pilih merge, squash atau rebase untuk setiap pull request.
You finished this before. Practice is always welcome!
Official docs: About merge methods on GitHub · About pull request merges
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?