What does git log --all do?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
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.
Related reading
- What does git push -u mean?
- What does git rev-parse do?
- What does it mean when Git says 'rewrite' or 'rename' in a commit message?
- What does the “…” meta line with at signs in svn diff or git diff mean?
- What does the exclamation mark mean in git config alias?
- What does the term porcelain mean in Git?
- What effect does the `--no-ff` flag have for `git merge`?
- What effect does the --no-ff flag have for git merge?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.