How do you view Git history in a compact, readable way?
Use git log --oneline for one line per commit, adding --graph --decorate --all to see branches and merges drawn as a tree. Options like -n, --author and --since filter the output.
Explain it simply
Plain git log prints a full paragraph per commit and quickly fills the screen. Compact options turn it into a timetable.
--oneline shows the short hash and the subject. --graph draws the branch lines with ASCII art. --decorate labels where branches and tags point. Add --all to include every branch, not just the current one. You can filter too: -5 for five commits, --author=Asha, --since="2 weeks ago", or -- path/file.js for the history of one file.
Many developers save the common combination as an alias.
Example
git log --oneline --graph --decorate --all
git log --oneline -5
git log --author="Asha" --since="2 weeks ago"
git log --oneline -- src/cart.js
git config --global alias.lg "log --oneline --graph --decorate --all"What to say in the interview
"I use git log --oneline --graph --decorate --all for an overview of branches and merges, and filter with -n, --author, --since or a file path when I am looking for something specific. I keep it as a git alias so it is one short command."