BM: Baca dalam Bahasa Melayu
World 11: Rescue Center
Fix a bad commit message
You will learn: how to fix a commit message, and when to leave it alone.
The problem
Your last commit says stuff. Stuff? Next week, nobody will know what it was. Not even you! This happens to everyone.
Try it
You haven’t pushed yet. What’s the quickest fix?
Pick one answer.
Watch
amend: Replace your last commit with a fixed one. swaps your last commit for a fresh copy. Same changes, new message, new hash.
Try it
Give the last commit a clear message.
Hint
Typegit commit --amend -m "Add day 2 entry", then press Enter.Predict
New story: it’s pushed, and teammates pulled it. Now what?
Pick one answer.
Check
Clear message, or needs work? Swipe each one.
Swipe right for good, left for needs work. Or use the buttons.
Add day 2 entryYou did it!
You can now fix a bad commit message, safely.
Go deeper (optional)
Bad message on an older commit? Before you push, git rebase -i can reword it (World 3). Already pushed, but on a branch only you use? Amend, then git push --force-with-lease replaces it safely (World 4). Never do that on a shared branch like main.
Bahasa Melayu
Commit (titik simpan) terakhir anda kata stuff. Stuff? Minggu depan, tiada siapa tahu apa itu. Anda pun tak tahu! Ini berlaku pada semua orang.
Anda belum push. Apa cara paling cepat?
Amend tukar commit terakhir anda dengan salinan baru. Perubahan sama, mesej baru, hash baru.
Beri commit terakhir mesej yang jelas.
git commit --amend -m "Add day 2 entry", kemudian tekan Enter.Cerita baru: dah push, dan kawan sepasukan dah pull. Sekarang apa?
Mesej jelas, atau perlu dibaiki? Leret setiap satu.
Kini anda boleh baiki mesej commit yang salah, dengan selamat.
You finished this before. Practice is always welcome!
Official docs: git commit --amend · git push --force-with-lease
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?