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.
git log --oneline --graph --decorate --allStep-by-Step Execution Guide
git log --graph --oneline --decorate --allDisplays a color-coded ASCII graph of all branches, tags, and commits in chronological order.
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.
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").
Related Git Command Guides
Browse All Git RecipesUndo your most recent Git commit while keeping all your edited files staged or unstaged in your working directory.
Discard all unstaged and uncommitted file modifications and restore your working tree to the latest commit.
Rename your current local branch and update the upstream remote tracking branch on GitHub or GitLab.
Delete a branch from remote origin (GitHub, GitLab, Bitbucket) after a pull request has been merged.
Amend the commit message of your latest commit before or after pushing.
Remove files from the Git staging area (index) without losing any of your local changes.