Plain git log prints every commit at full width, oldest context buried pages deep. Nobody reads it. The flags below are the difference between archaeology and a quick look at the map.
The map#
git log --oneline --graph --decorate
One line per commit, branch structure drawn, branches and tags labelled. Add --all to see every branch at once instead of just the one you are on. This combination answers “where is everything right now” faster than any GUI, and it is the natural first step before a rebase or a release.
The filter#
git log --oneline --since="2 weeks ago" --author=sara
Time and author filters narrow the noise. The one that earns its keep before a release:
git log --oneline v1.4.0..main
Everything on main since the tag - exactly the input a changelog needs.
The detail#
When a commit list shows something interesting, two flags show what it did without leaving the log:
git log --stat # files changed and how much
git log -p # the full diff per commit
The tracers#
Two more for tracking specific things through time:
git log --follow -p -- app/Models/Invoice.php # history across renames
git log -S 'QUEUE_CONNECTION' --oneline # when did this string appear or vanish
--follow matters on Laravel apps, where files move as the structure settles; the pickaxe (-S) finds the commit that introduced or removed a setting, a call, or a constant.
What a branch actually adds#
Before reviewing or merging:
git log --oneline main..feature/invoice-pdf
Just the commits the branch contributes, nothing main already has. Pair with git diff main...feature/invoice-pdf --stat and you know the shape of a PR before opening it.
None of this needs memorising as a wall of flags. Keep the map (--oneline --graph --decorate) as a shell alias, learn the range form (a..b), and look the rest up when you need it - the habit that matters is reading history before you change it.
Share this post
Keep reading
Annotating Commits with git notes: Metadata Without Rewriting History
Some things belong on a commit but not in it: review links, benchmark results, the ticket nobody remembered to reference. git notes adds them after the fact, no rebase required.
Backing Up Your Git Server So It Actually Restores
Every clone is a partial backup - but hooks, config and server state live outside the repo. Mirror, bundle, copy off-site, and rehearse the restore.
Cherry-Picking: One Commit Without the Branch
Cherry-pick copies a single commit onto your branch and leaves the rest behind. Right for hotfixes across release branches, wrong as a sync strategy.