Lesson 4: What is a Commit? (The Heart of Git)
Take notes ✍️
This lesson will connect everything you’ve seen so far.
1️⃣ Let’s Start From What YOU Observed
You said:
“I could see from what to what I made the change. How many new lines got added.”
📌 That screen you saw is called a DIFF.
📘 Definition:
A diff shows the exact difference between the old version and the new version of a file.
Git does NOT just save files —
👉 it saves changes.
2️⃣ So… What Exactly is a Commit?
📌 Proper Definition (Write This):
A commit is a snapshot of changes made to files, saved with a message describing what changed.
Break it down:
• Snapshot 📸
• Of changes
• With an explanation
3️⃣ What Happens When You Commit?
Behind the scenes, Git does this:
1. Compares old file vs new file
2. Calculates differences (diff)
3. Saves those differences safely
4. Attaches:
○ Author
○ Time
○ Message
That’s why you saw:
• Lines added ➕
• Lines removed ➖
4️⃣ Why Commits Are Powerful
Write these points clearly:
✔ You know what changed
✔ You know when it changed
✔ You know who changed it
✔ You can go back in time
✔ You can review work confidently
This is why Git is trusted everywhere.
5️⃣ Commit Message Matters 📝
Every commit has a message.
Example:
• ❌ update
• ❌ changes
• ✅ Add project purpose to README
• ✅ Update README with author name
📌 A good commit message:
• Short
• Clear
• Describes what changed
6️⃣ Commit History = Project Story 📖
Each commit is a chapter.
Example:
1. Create repository
2. Add README
3. Update README purpose
4. Fix typos
GitHub stores this story forever.
7️⃣ Important Clarification (Beginner Mistake)
❌ Commit ≠ Upload entire project again
Git stores:
• Only differences
• Very efficiently
That’s why Git is fast.
🙂
That’s great to hear — and thank you for being an attentive, thoughtful student. You’re progressing exactly the way a professor hopes a beginner will.
Since there are no doubts, we’ll continue in our structured way.
📝 HOMEWORK
(Short, confidence-building)
1️⃣ Commit Practice
In your repository git-github-learning:
1. Edit README.md
2. Add one new line, for example:
○ “This repository will be updated as I progress.”
3. Commit the change with a clear message, such as:
○ Add progress note to README
📌 Focus on the message — clarity matters.
2️⃣ Observation Task
After committing, click on:
• The commit message
• Observe:
○ Lines added
○ Timestamp
○ Your name as author
Just observe — understanding will deepen naturally.