Reading History: log
You already have a chain of commits — but how do you actually read it? In this lesson we meet git log, the command that pages back through history: from the latest commit, through its parent, and its parent's parent, all the way to the start of the project. We'll see how git log --oneline gives one
git log is the project's travel journal: each commit is an entry, and the command reads them newest to oldest. --oneline shortens each entry to a single line, and HEAD is the 'you are here' marker on the latest entry.
- git log
- Lists commits newest to oldest, walking the parent chain. Each entry includes a hash, author, date, and message.
- git log --oneline
- A compact form of git log: one line per commit — a short hash followed by the commit message. Great for a quick overview.
- HEAD
- A 'you are here' marker pointing to the latest commit of your current branch. Usually the commit your next work builds on.
- Commit message
- The short sentence describing what changed in a commit. A good message makes history readable — it's what you'll see in git log months later.
- git show
- Shows a single commit in full: its message and details, together with the line-by-line change it introduced. Handy when log surfaced an interesting hash.