1.3 History and HEAD
Git history is not a pile of random backups. Commits form a chain, and each commit knows its parent commit.
Inspect history
bash
git log --onelinegit log shows history starting from the current commit. --oneline compresses each commit into one line, which is easier to scan.
Loading interactive lab...
What is HEAD?
HEAD is the marker for your current position. Usually, HEAD follows the current branch: when you make a new commit, the branch moves forward and HEAD follows it.
If you check out an old commit, HEAD moves to that old position. It is like standing at a past moment in history.
Loading concept check...
Commit messages are for future readers
A commit message is not decoration. Weeks later, Fix login redirect after OAuth callback is much more useful than fix.
Loading concept check...
bash
git commit -m "Add empty state for search"A practical habit is to start with a verb: Add, Fix, Update, Remove, Refactor.