Skip to content

Latest commit

 

History

History
119 lines (69 loc) · 2.55 KB

File metadata and controls

119 lines (69 loc) · 2.55 KB

📜 git log (View History)


🎯 What It Does

Shows commit history.


🧪 Commands

git log

Short version:

git log --oneline

📸 Visual (Commit Graph)

Image

Image

Image

Image

Image

Image


🧠 Mental Model

git log = reading the story of your project


🏗 Internal Architecture

Git does NOT store history as a list.

It stores it as a graph (DAG):

👉 Directed Acyclic Graph


🔬 How git log Works

git log:

  • starts from HEAD
  • follows parent commits
  • prints history backwards

🧩 Example

A ← B ← C ← HEAD

git log shows:

C
B
A

🔥 Useful Commands

git log --oneline
git log --graph
git log --all

⚠️ Common Mistake

Thinking history is linear.

👉 It becomes complex with branches.


🧠 Why This Matters

Because:

  • debugging depends on history
  • merges create graphs
  • rebasing rewrites history

🧠 Memory Trick

git log = history viewer


➡️ Next Step

👉 11-git-diff.md