BM: Baca dalam Bahasa Melayu
World 1: Save Points
Three places your work lives
You will learn: the three places Git keeps your work.
The problem
You pressed save in your editor. So Git saved it too, right? Not yet! Your work can sit in three places.
Watch
Place 1 is the working folder. These are your normal files. You edit them here.
Watch
Place 2 is the staging area, a box. git add puts ready changes in the box.
Watch
Place 3 is the repository. git commit takes a photo of the box and keeps it here, safe.
Predict
You make a new file, notes.txt. Where is it now?
Pick one answer.
Predict
You type git add notes.txt. Where is it now?
Pick one answer.
Predict
You type git commit -m "Add notes". Where does the saved copy go?
Pick one answer.
You did it!
You can now name the three places your work lives.
Go deeper (optional)
You will meet other names for these places. The working folder is also called the working tree. The staging area is also called the index. The repository lives inside the hidden .git folder.
Bahasa Melayu
Anda tekan simpan dalam editor. Jadi Git pun dah simpan, kan? Belum lagi! Kerja anda boleh berada di tiga tempat.
Tempat 1 ialah folder kerja (working folder). Ini fail biasa anda. Anda ubah fail di sini.
Tempat 2 ialah kawasan staging, iaitu sebuah kotak. git add masukkan perubahan yang siap ke dalam kotak.
Tempat 3 ialah repository (stor sejarah projek). git commit ambil gambar isi kotak dan simpan di sini dengan selamat.
Anda buat fail baru, notes.txt. Di mana ia sekarang?
Anda taip git add notes.txt. Di mana ia sekarang?
Anda taip git commit -m "Add notes". Ke mana salinan yang disimpan pergi?
Kini anda boleh namakan tiga tempat kerja anda tinggal.
You finished this before. Practice is always welcome!
Official docs: gitglossary (working tree, index) · git add · git commit
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?