BM: Baca dalam Bahasa Melayu
World 1: Save Points
Your first save point
You will learn: how to make a commit, and what is inside one.
The problem
Tonight your home page works. Tomorrow you might break it. Can you get tonight’s version back? Only with a save point.
Watch
git commit takes a snapshot: a full photo of the box, right now. The words after -m are a short note about it.
Try it
Save index.html as a new commit.
- Empty
- 1 save point
- Add README
Hint
Two steps:git add index.html, then git commit -m "Add home page".Watch
git log lists your commits, newest first. The long code after “commit” is the hash. It is that commit’s unique name.
Watch
Each new commit points back to the one before it. That older commit is its parent. Together they make your timeline.
Check
Which one is NOT saved inside a commit?
Pick one answer.
Try it
Now do it for real, on your own computer. Type each command yourself. Copy only if you get stuck.
Real mission
mkdir real-diarycd real-diarygit initecho "<h1>My Diary</h1>" > index.htmlgit add index.htmlgit commit -m "Add home page"git log
0 of 8 steps done · Your ticks are saved.
Hint
Stuck insidegit log? Press q to get out.You did it!
You can now make a commit and read it in git log.
Go deeper (optional)
git show prints the newest commit and exactly what changed in it. Want a longer note? Add a second -m. The first one becomes the title, the second the body.
Bahasa Melayu
Malam ini laman utama anda berfungsi. Esok mungkin anda rosakkannya. Boleh dapat balik versi malam ini? Hanya dengan titik simpan.
git commit ambil satu snapshot (gambar penuh isi kotak pada masa itu). Perkataan selepas -m ialah nota pendek tentangnya.
Simpan index.html sebagai commit (titik simpan) baru.
git add index.html, kemudian git commit -m "Add home page".git log senaraikan commit anda, yang terbaru dulu. Kod panjang selepas “commit” ialah hash (id commit). Itu nama unik commit tersebut.
Setiap commit baru tunjuk balik ke commit sebelumnya. Commit lama itu ialah parent (induk). Bersama, ia jadi garis masa anda.
Yang mana TIDAK disimpan dalam commit?
Sekarang buat betul-betul, dalam komputer anda sendiri. Taip setiap arahan sendiri. Salin hanya kalau tersekat.
git log? Tekan q untuk keluar.Kini anda boleh buat commit dan baca dalam git log.
You finished this before. Practice is always welcome!
Official docs: git commit · git log · git show
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?