Engine behind git log, cherry, bisect — the DAG walker.
git rev-list is the DAG walker that powers log, cherry, bisect, and most history-aware plumbing. If you script anything about commits, you reach for it.
Give it a set of tips and exclusions; it emits commit SHAs in topo order. log is rev-list with formatting bolted on - rev-list is the engine, not the UI.
git rev-list [<options>] <commit>... [-- <path>...]
A..B # commits reachable from B but not A
A...B # symmetric difference
^A B # B minus A (same as A..B for two refs)
--count # just print the number
--objects # also list trees and blobs reachable
| Flag | What it does |
|---|---|
<commit>... | Tip commits to walk from |
^<commit> | Exclude this commit and its ancestors from the walk |
--max-count=<n> | Stop after n commits |
--reverse | Output oldest-first instead of newest-first |
--first-parent | Follow only the first parent of merges (linearize) |
--no-merges | Skip merge commits |
--ancestry-path | Only commits on a path between two endpoints |
--bisect | Pick the midpoint commit (used by git bisect) |
--count | Print the count instead of the SHAs |
--objects | Also emit referenced tree and blob SHAs |
--pretty[=<fmt>] | Format each commit (turns rev-list into log) |
git rev-list --count main..@{u}.git rev-list --left-right --count main...origin/maingit rev-list --first-parent --no-merges maingit rev-list --objects --all | headgit rev-list --reverse main..feature--count instead of wc -l piping; it is faster and semantically clearer.--objects with git cat-file --batch-check for pack/object size auditing.^ or .. syntax: git rev-list main feature walks BOTH tips, not the diff.Hit each option, then Check answers. Score is recorded; Next is always open.