git
git log
command line
version control
development tools

What does git log --all do?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

git log --all tells Git to show commits reachable from every reference, not just the current branch. This is especially useful in repositories with feature branches, remote-tracking branches, and tags where history is spread across many tips. It is a discovery command that helps you see the complete reachable commit graph quickly.

What --all Expands To

Without flags, git log walks backward from HEAD only. With --all, Git walks from all refs under standard namespaces such as heads, remotes, and tags.

In practical terms:

  • git log means show history of current checked-out branch.
  • git log --all means include history from local branches, remote-tracking branches, and tag tips.

This can reveal commits you did not know existed locally yet, such as merged topic branches or remote-only branches fetched earlier.

Try both commands side by side:

bash
git log --oneline -n 10
git log --all --oneline -n 10

The second output usually contains additional commits from other refs.

Best Companions: Graph, Decorate, and Oneline

--all becomes far more readable when combined with graph visualization and ref labels.

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

This view helps answer:

  • Which branch introduced a commit.
  • Where merges happened.
  • Whether two branches diverged or already converged.

For large repos, add date or author filters:

bash
git log --all --graph --decorate --oneline --since="2 weeks ago"
git log --all --author="alex" --oneline

Filtering keeps full-history queries useful instead of overwhelming.

Difference From Similar Flags

Several flags look similar but have different scope.

--all includes all refs. --branches includes local branch refs only. --remotes includes remote-tracking refs only. --tags includes tag refs only.

Examples:

bash
git log --branches --oneline
git log --remotes --oneline
git log --tags --oneline

If you are investigating why a commit appears in your local object database, --all is the broadest first check.

Practical Use Cases

Typical workflows where --all is valuable:

  • Auditing merge paths before release.
  • Finding commits from deleted local branches that still exist via tags or remotes.
  • Understanding where a bugfix entered history.
  • Preparing cleanup of stale branches.

A quick commit locator pattern:

bash
git log --all --grep="payment retry" --oneline

If a commit hash is known, pair with branch containment checks:

bash
git branch --contains <commit_hash>
git branch -r --contains <commit_hash>

This clarifies which lines of development include the commit.

Performance and Repository Size Considerations

On very large repositories, git log --all can be expensive. Narrow query scope when possible.

Useful constraints:

  • limit output count with -n
  • filter by paths
  • filter by date range
  • use --simplify-by-decoration for high-level graph review
bash
git log --all --oneline -n 200 -- src/payment/
git log --all --simplify-by-decoration --graph --decorate --oneline

These options reduce noise while retaining branch-level insight.

Helpful Aliases for Daily Use

If you run this often, define an alias for consistent output.

bash
git config --global alias.lga "log --all --graph --decorate --oneline"

Now run:

bash
git lga

Standardized history views across teammates make debugging and code review conversations easier.

Common Pitfalls

  • Assuming git log --all includes commits not referenced by any ref.
  • Forgetting that stale remote-tracking branches may still appear until pruned.
  • Running full-history graph on huge repositories without filters.
  • Interpreting graph lines without --decorate, which hides ref names.
  • Confusing --all with searching unreachable objects in reflog or garbage collection contexts.

Summary

  • git log --all shows commit history reachable from all refs.
  • It is broader than plain git log on current branch.
  • Combine with --graph --decorate --oneline for practical readability.
  • Use filters to control output size in large repositories.
  • It is ideal for branch topology analysis and cross-branch commit discovery.

Course illustration
Course illustration

All Rights Reserved.