BM: Baca dalam Bahasa Melayu
World 1: Save Points
Look back in time
You will learn: how to read your history with git log and git show.
The problem
Your diary title now says “My Git Diary”. When did that change? And what did the page look like before?
Watch
git log --oneline puts each commit on one line: short hash, then message. The newest is on top.
Try it
Slide back to the very first commit. Watch index.html change.
78933de Change title to My Git Diary · Commit 5 of 5
index.html<h1>My Git Diary</h1><p>Day 1: I made a repo.</p><p>Day 2: I learned the box.</p><p>Day 3: I made my first commit.</p>
Hint
Drag the slider all the way left, then back right.Watch
--graph draws your timeline with stars and lines. --all adds every branch: A storyline of commits. Each branch has a name, like main.. You have just one, so it is a straight line.
Watch
git show plus a hash opens one commit: who, when, and exactly what changed. Green + lines were added.
Try it
Find the hash of “Add day 2 entry”. Then open it with git show.
Hint
Start withgit log --oneline. Copy the code next to “Add day 2 entry”.Check
You want to see exactly what one commit changed. Which command?
Pick one answer.
You did it!
You can now travel back through your history and see every change.
Go deeper (optional)
git log -n 2 shows only the newest two commits. A long log opens in a pager. Press Space for more, and q to quit. git show with no hash shows your newest commit.
Bahasa Melayu
Tajuk diari anda kini “My Git Diary”. Bila ia berubah? Dan macam mana rupa laman itu sebelum ini?
git log --oneline letak setiap commit (titik simpan) pada satu baris: hash pendek, kemudian mesej. Yang terbaru di atas.
Gerakkan peluncur ke commit yang paling awal. Tengok index.html berubah.
--graph lukis garis masa anda dengan bintang dan garis. --all tambah setiap branch (cabang). Anda ada satu sahaja, jadi garisnya lurus.
git show dengan hash buka satu commit: siapa, bila, dan apa sebenarnya yang berubah. Baris hijau + ialah yang ditambah.
Cari hash untuk “Add day 2 entry”. Kemudian buka dengan git show.
git log --oneline. Salin kod di sebelah “Add day 2 entry”.Anda nak tengok apa sebenarnya yang satu commit ubah. Arahan mana?
Kini anda boleh mengembara dalam sejarah projek dan nampak setiap perubahan.
You finished this before. Practice is always welcome!
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?