Before committing anything, it's worth actually seeing what's about to be saved — these three commands are how.
git status
# On branch main
# Changes not staged for commit:
# modified: index.html
#
# Untracked files:
# style.cssThe single most-run Git command in practice — showing which files are modified, staged, or untracked, and what to do next.
# See unstaged changes, line by line
git diff
# See staged changes (what's about to be committed)
git diff --staged- <h1>Old Heading</h1>
+ <h1>New Heading</h1>A line starting with - was removed, + was added — the same convention used in the earlier PHP Security lesson's vulnerable/safe code comparisons.
git log
# commit a1b2c3d4e5f6... (HEAD -> main)
# Author: Sam <sam@example.com>
# Date: Wed Sep 3 10:00:00 2026
#
# Add README| Command | Shows |
|---|---|
| git log --oneline | One line per commit — a compact summary |
| git log -p | The full diff for every commit, not just the message |
| git log --author="Sam" | Only commits by a specific person |
| git log --since="2 weeks ago" | Only recent commits |
| git log -- filename.txt | Only commits that touched a specific file |
git log --oneline --graph
# * a1b2c3d Add README
# * e5f6g7h Initial commitA command worth memorizing
git log --oneline --graph is worth memorizing as a habit — it's the fastest way to see a project's recent history and branch structure at a glance, and becomes essential once branching (the next few lessons) is in the picture.