Git Basics10 min readMarch 10, 2026

How to View Git Commit History: The Complete Guide

Everything you need to view, navigate, and understand your git commit history — from basic git log to advanced filtering and visualization.

git log: Your Starting Point

Every git repository stores a complete history of every change ever made. The git log command is how you access it. Run it with no arguments to see the full commit history of the current branch.

# Full commit history
git log

# Condensed one-line view
git log --oneline

# Show the last 10 commits
git log -10

Each entry shows the commit hash (a unique SHA-1 identifier), the author, the date, and the commit message. The hash is how git identifies every snapshot of your project.

Visualize Branch and Merge History

Real projects have branches and merges. The --graph flag draws an ASCII representation of the branch structure alongside the log. Combine it with --all to see every branch, not just the current one.

# ASCII branch graph
git log --oneline --graph --all

# With decorations showing branch names
git log --oneline --graph --all --decorate

This is the closest thing to a "visual git history" in the terminal. For a richer experience, tools like Git Progress render your commit history as interactive charts and contribution grids across all your repositories.

Inspect a Specific Commit

Use git show to see the full details of any commit — the metadata plus the actual diff of changes.

# Show a commit by hash
git show abc1234

# Show just the files changed (no diff)
git show --stat abc1234

# Show the most recent commit
git show HEAD

View History for a Specific File

Append a file path after -- to scope the history to changes that affected that file. Add -p to see the actual line-by-line diff in each commit.

# Commits that touched a file
git log -- README.md

# With diffs
git log -p -- README.md

# Who changed each line (blame)
git blame README.md

Commit Stats and Summaries

The --stat flag shows a summary of files changed, insertions, and deletions for each commit. The --shortstat flag gives just the totals.

# File-level change summary
git log --stat

# Just the numbers
git log --shortstat

# Total lines changed by author
git shortlog -sn

These stats are exactly what Git Progress aggregates for you automatically — commits, lines changed, and active repos — in beautiful weekly and monthly reports.

Compare Commits and Ranges

Use git diff with commit hashes to compare any two points in history. The double-dot syntax shows what changed between two commits.

# Diff between two commits
git diff abc1234..def5678

# What changed on a branch since it diverged
git log main..feature-branch --oneline

# Changes in the last 3 commits
git diff HEAD~3..HEAD

Stop running git log manually

Git Progress aggregates your commit history across GitHub, GitLab, and Bitbucket into beautiful dashboards. Free for individual developers.

Get Started Free