1. What is this?
Saving happens in two steps. Staging (git add) marks which changes go into the next snapshot. Committing (git commit -m "message") records that snapshot with a message describing it. A good message is imperative and specific: 'Add signup form', not 'stuff'.
2. Why do we use it?
Two steps let you craft clean snapshots: group related changes, leave the rest for later.
3. Syntax breakdown
git add notes.txt
Stages notes.txt — marks it for the next commit. git add . stages everything.
git commit -m "Add notes file"
-m sets the message inline. Records the staged snapshot.
git log
Shows the history of commits, newest first.
5. Common mistakes
- Committing without staging (nothing happens — add first).
- Vague messages like 'update' that explain nothing later.
- Committing huge unrelated changes in one snapshot — split them.
Practice task
Stage everything and commit with message "Describe the plan".
Hint
git add . then git commit -m "Describe the plan"
Try it below — tests run automatically when you press Run.
Output
Press Run to see output.
Mini quiz
3 questions. Answer, then check.
1. What does git add do?
2. What makes a good commit message?
3. What does git log show?