World map

 

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

index.html wobbles with a changed tag. Its title now says My Git Diary.

Your diary title now says “My Git Diary”. When did that change? And what did the page look like before?

Watch

git log --oneline lists five commits, one per line, from Change title to My Git Diary down to Add home page. Terminal output: $ git log --oneline 78933de (HEAD -> main) Change title to My Git Diary d57aaf3 Add day 3 entry bc602fc Add day 2 entry abc5111 Add day 1 entry 7d2fe9d Add home page

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>

Watch

The same five commits, each with a star in front, joined in one straight line. Terminal output: $ git log --oneline --graph --all * 78933de (HEAD -> main) Change title to My Git Diary * d57aaf3 Add day 3 entry * bc602fc Add day 2 entry * abc5111 Add day 1 entry * 7d2fe9d Add home page

--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 bc602fc: the Add day 2 entry commit, then one new green line, Day 2: I learned the box. Terminal output: $ git show bc602fc commit bc602fc6482595a6cb712215e1edd2a6963b2eff Author: You <you@example.com> Date: Fri Oct 30 09:03:00 2026 +0800 Add day 2 entry diff --git a/index.html b/index.html index 5a63042..98811d7 100644 --- a/index.html +++ b/index.html @@ -1,2 +1,3 @@ <h1>My Diary</h1> <p>Day 1: I made a repo.</p> +<p>Day 2: I learned the box.</p>

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.

7d2fe9dabc5111bc602fcd57aaf378933de

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.

git log --oneline -n 2 shows only the two newest commits. Terminal output: $ git log --oneline -n 2 78933de (HEAD -> main) Change title to My Git Diary d57aaf3 Add day 3 entry