๐Ÿ” HistoryCommonly used

How to view commit history in Git

Browse and search through past commits.

View commit log
git log

Shows full commit history with hash, author, date and message.

Compact one-line log
git log --oneline

Shows each commit on one line with short hash and message.

When to use: Quick overview of recent history.

Log with branch graph
git log --oneline --graph --all

Visual ASCII graph showing branches and merges.

When to use: Understanding branching history.

Log for a specific file
git log --follow filename.txt

Shows only commits that touched a specific file.

When to use: Tracing the history of a specific file.

Log by author
git log --author="John"

Filters commits by author name.

Log since a date
git log --since="2 weeks ago"

Shows commits from the last 2 weeks.

โ† Back to Git Reference