Back
GitoryxGitoryx
Beginner9 min read

Git Log: How to Browse Your Commit History

git log is your window into the full history of a project. This tutorial covers the essential flags — --oneline, --graph, --all, --author, --since — and shows how to turn raw log output into a readable, filterable audit trail.

The Problem

You need to see what changed last week, or find the commit that introduced a bug, or understand the history before merging a branch — but running plain git log dumps an endless wall of commits and you don't know how to filter or format it.

git log is how you navigate your project's history. The right flags transform it from raw output into a readable commit graph, a targeted file history, or a filtered audit trail. It's also the first step before git bisect, git revert, or git cherry-pick.

Common mistakes developers make with this:

  • Running git log with no flags and getting lost in the raw output
  • Not knowing --oneline --graph --all — the combination that makes history readable in seconds
  • Forgetting that git log only shows the current branch by default, not all branches
  • Not using git log -- <file> to trace the history of a specific file

Gitoryx: Gitoryx replaces git log with an always-visible interactive commit graph — every branch and merge is drawn in color, commits are searchable by message or author, and clicking any commit shows its full diff instantly.

What is Log: How to Browse Your Commit History?

git log displays the commit history of the current branch. Each entry shows the commit SHA, author, date, and message. With flags like --oneline, --graph, --all, --author, and --since, it becomes a powerful tool for navigating, filtering, and auditing any project's history.

Step-by-Step Guide

1

Run git log

The default git log output shows full commit details: SHA, author, date, and message. Use arrow keys to scroll, press q to quit.

bash
git log

# commit a3f2c1d4e5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0
# Author: Jane Dev <jane@example.com>
# Date:   Mon Jun 2 14:32:11 2025 +0200
#
#     add login form validation
#
# commit 9b1e4fa2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8
# Author: Jane Dev <jane@example.com>
# Date:   Fri May 30 10:15:00 2025 +0200
#
#     init project structure

Press q to exit the log viewer. Press / to search for a string within the log output.

2

Use --oneline for a compact view

--oneline shows each commit on a single line: short SHA and subject only. This is the fastest way to scan recent history.

bash
git log --oneline

# a3f2c1d add login form validation
# 9b1e4fa init project structure
# 7c0d2ae initial commit
3

Visualize the branch graph with --graph --all

Combine --oneline, --graph, and --all to see the full branch history as an ASCII graph, including every branch and merge point.

bash
git log --oneline --graph --all

# * a3f2c1d (HEAD -> main, origin/main) add login form validation
# | * f8e7d6c (feature/dashboard) add dashboard route
# |/
# * 9b1e4fa init project structure
# * 7c0d2ae initial commit

This is the most useful single git log command. Consider aliasing it: git config --global alias.lg 'log --oneline --graph --all'.

4

Filter by author

Use --author to show only commits from a specific person. The value is matched as a substring against the author name and email.

bash
git log --oneline --author="Jane"

# Shows only commits by authors whose name or email contains "Jane"
See this workflow in Gitoryx — Gitoryx screenshot

See this workflow in Gitoryx. The commit graph panel shows every branch and merge visualized in color — no flags needed

Free download
5

Filter by date

Use --since and --until to limit commits to a time range. Dates can be absolute (YYYY-MM-DD) or relative ('2 weeks ago', 'yesterday').

bash
# Commits from the last 7 days
git log --oneline --since="7 days ago"

# Commits in a specific range
git log --oneline --since="2025-05-01" --until="2025-05-31"
6

Show the history of a specific file

Use -- <file> to show only commits that touched a specific file. The double dash separates command options from the file path.

bash
git log --oneline -- src/app.ts

# Shows every commit that modified src/app.ts

If a file was renamed, add --follow to track it across renames: git log --follow --oneline -- src/app.ts.

7

Show what changed in each commit

The --stat flag shows a summary of lines changed per file. The -p flag shows the full diff for each commit — more detailed but noisier.

bash
# Summary of changes per file
git log --oneline --stat

# Full diff for each commit (limit to last 3)
git log -p -3

Common Mistakes to Avoid

Forgetting --all and only seeing the current branch

By default, git log only shows commits reachable from the current branch. If you switch branches, the other branch's commits disappear from the log without --all.

Fix: Add --all to see commits from every branch. Or pass a branch name directly: git log --oneline origin/main.

Not using --follow for renamed files

git log -- <file> stops showing history at the point a file was renamed. Without --follow, you'll miss the earlier commits under the old filename.

Fix: Use git log --follow --oneline -- <file> to trace a file's full history across any renames.

Confusing git log with git diff

git log shows *which commits* exist and their metadata. git diff shows *what changed* between two specific states. They answer different questions.

Fix: Use git log to find which commit to examine, then use git show <sha> to see the full diff of that single commit.

Gitoryx — visual Git client for macOS & Windows
GitoryxGitoryx — macOS & Windows

Browse your full commit history visually in Gitoryx

  • The commit graph panel shows every branch and merge visualized in color — no flags needed
  • Click any commit to see its full diff, author, and affected files in a side panel
  • Filter commits by author, branch, or date range with a single search field
  • Gitoryx shows all branches and the remote simultaneously, replacing --all --graph permanently
Download Gitoryx — FreemacOS · Windows · No subscription

Frequently Asked Questions

How do I see the git log for just one file?

Use git log --oneline -- <filepath>. The double dash separates the file path from other flags. Add --follow to also include history from before the file was renamed.

What does `git log --all` do?

--all includes commits from all local and remote branches and tags in the output, not just the current branch. Combined with --oneline --graph, it gives you a full picture of the entire repository.

How do I search git log by commit message?

Use git log --grep='search term' --oneline. This filters to commits whose message contains the search string. Add -i for case-insensitive matching.

How do I see the last N commits?

Use git log -N where N is a number. For example, git log -5 --oneline shows the last 5 commits in compact format.

What is the difference between git log and git show?

git log lists multiple commits with metadata. git show <sha> displays the full details and diff of a single specific commit. Use git log to find a commit, then git show <sha> to inspect it.

See it in action with Gitoryx

Everything in this tutorial is faster and clearer with a visual Git client. Gitoryx is free, runs natively on macOS and Windows, and built for developers who want to move fast without breaking things.