Creates a snapshot of your staged changes.
git commit -m "Add feature"Commit = snapshot of entire project + metadata
When you run git commit, Git creates a commit object.
A commit contains:
commit <hash>
Author: Your Name
Date: timestamp
Message: "Add feature"
Points to:
- tree (project snapshot)
- parent commit(s)
Git stores commits here:
.git/objects/
Each object is stored using a SHA-1 hash.
Example:
a1/b2c3d4e5...
Commit → Tree → Blobs
- represents folder structure
- represents file content
Each commit points to its parent:
A → B → C
👉 This creates history chain
Because now you understand:
- commits are not just messages
- commits form a graph
- history is linked via parents
- vague messages ("update")
- committing too much at once
- not staging properly
git commit -m "Add login validation"Commit = snapshot + message + history link
👉 10-git-log.md