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 logmeans show history of current checked-out branch.git log --allmeans 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:
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.
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:
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:
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:
If a commit hash is known, pair with branch containment checks:
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-decorationfor high-level graph review
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.
Now run:
Standardized history views across teammates make debugging and code review conversations easier.
Common Pitfalls
- Assuming
git log --allincludes 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
--allwith searching unreachable objects in reflog or garbage collection contexts.
Summary
git log --allshows commit history reachable from all refs.- It is broader than plain
git logon current branch. - Combine with
--graph --decorate --onelinefor practical readability. - Use filters to control output size in large repositories.
- It is ideal for branch topology analysis and cross-branch commit discovery.

