How to View a Condensed Git History (git log --oneline)
git log --oneline shows each commit as a single line with its short hash and message, making long histories much easier to scan.
Published September 27, 2026
git log --oneline prints each commit on one line with its short hash and subject, giving a compact overview of history.
How it works
Combine it with --graph and --decorate to see branches and tags, which is the most useful everyday view.
Create an alias so you do not retype the options.
Try it
git log --oneline -4
a1b2c3d Fix login redirect
d4e5f6a Add search
9f8e7d6 Initial commit
Practical examples
Compact graph of all branches
git log --oneline --graph --decorate --allCreate an alias
git config --global alias.lg "log --oneline --graph --decorate --all"
git lgLast 10 commits
git log --oneline -10Between two refs
git log --oneline v1.0..HEADCommon mistakes
- Forgetting --all to see other branches.
- Truncating too early and missing context.
- Not decorating, so tags and branches are invisible.
Key takeaways
- --oneline = one line per commit.
- Add --graph --decorate.
- Alias it.
FAQ
What is the short hash?
The first 7+ characters of the full SHA.
Can I show dates?
Use --pretty=format:'%h %ad %s' --date=short.