Log Flags
What
The standard git log output provides extremely detailed information, but it can be overwhelming and difficult to read. Git provides formatting flags to condense, decorate, or simplify this output.
How
You can customize the log output by adding formatting arguments:
-
--oneline: Condenses each commit down to a single line containing its short hash and commit message:git log --oneline -
--decorate: Controls how branch and tag references are displayed next to commit entries:short(default): Displays short branch names (e.g.,(HEAD -> main, add_classics)).full: Displays the absolute pointer reference names (e.g.,(HEAD -> refs/heads/main, refs/heads/add_classics)).no: Completely hides branch and reference indicators.
# Example combining flags for a highly condensed, decorated view
git log --oneline --decorate=full
Why
Using formatting flags like --oneline is essential when inspecting large repositories with thousands of commits. It allows you to see many commits on a single screen, track where branch splits occur, and find specific commit hashes without scrolling through pages of author and date metadata.
Summary
Use --oneline to condense commit logs and --decorate to control how branch reference names (refs) are annotated next to historical commit entries.