Undo & History

How to View Git Commit History as a Beautiful One-Line Graph

Format git log into an easy-to-read ASCII branch graph with short hashes, relative dates, author, and branch labels.

Instant 1-Line Solution
Safe CommandBeginner
git log --oneline --graph --decorate --all
When to use this scenario:You want a visual branch overview of merges, branches, and commits directly in your terminal without opening a GUI app.

Step-by-Step Execution Guide

1Standard compact one-line graph
git log --graph --oneline --decorate --all

Displays a color-coded ASCII graph of all branches, tags, and commits in chronological order.

2Create a permanent alias "git lg"
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Allows you to simply type "git lg" anytime to view a beautifully formatted terminal log.

Critical Pitfalls & Precautions

  • β€’Press "q" in your terminal to exit the git log pager view.
Frequently Asked Questions

Git Log Pretty Graph - Frequently Asked Questions

Common questions about safe rollback, remote history implications, and troubleshooting.

Add "-n 10" to the command (e.g. "git log --oneline --graph -n 10").