BM: Baca dalam Bahasa Melayu
World 3: Parallel Universes
The old way: git checkout
You will learn: to read old guides that use git checkout for branches.
The problem
An old guide says git checkout -b. Your friend says git switch -c. Who is right?
Watch
Both are right! git checkout dark-mode works like git switch dark-mode. And git checkout -b works like git switch -c.
Try it
Build the old way to make fix-typo and hop onto it.
Tap the pieces in the right order.
Hint
checkout makes a branch with-b.Try it
You are on dark-mode. Go back to main, the old way.
Hint
Typegit checkout main, then press Enter.Check
Old git checkout did two jobs. Which new command does each job now?
Drag a card into a box. Or tap the card, then tap the box.
Predict
Git 3.0 is coming. Will it remove git checkout?
Pick one answer.
You did it!
You can now read old guides that use git checkout.
Go deeper (optional)
git checkout does two jobs: branches and files. That mix confused people. So Git 2.23 added git switch for branches and git restore for files. Careful: git checkout -- file throws away your changes, like git restore. Prefer the new commands. They say what they do.
Bahasa Melayu
Panduan lama kata git checkout -b. Kawan anda kata git switch -c. Siapa yang betul?
Dua-dua betul! git checkout dark-mode sama macam git switch dark-mode. Dan git checkout -b sama macam git switch -c.
Bina cara lama untuk buat fix-typo dan terus pindah ke situ.
-b.Anda di dark-mode. Kembali ke main, guna cara lama.
git checkout main, kemudian tekan Enter.git checkout lama buat dua kerja. Arahan baru mana yang buat setiap kerja sekarang?
Git 3.0 akan datang. Adakah ia akan buang git checkout?
Kini anda boleh baca panduan lama yang guna git checkout.
You finished this before. Practice is always welcome!
Official docs: git checkout · git switch · git restore · Git 3.0 breaking changes
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?