Appearance
rev-list Quick Reference
The plumbing commit traversal engine. If you know git log flags, you know rev-list flags. Difference: rev-list outputs raw SHAs (no diffs).
Counting
bash
git rev-list --count v1.0..HEAD # commits since tag
git rev-list --count v1.0...v2.0 # symmetric diff count
git rev-list --count --since="7 days" HEAD # recent commits
git rev-list --count HEAD -- src/api/ # commits touching pathFiltering
bash
# By time
git rev-list --after="2026-08-01" --before="2026-09-01" HEAD
# By author
git rev-list --author="jane@example.com" --since="7 days ago" HEAD
# By message
git rev-list --grep="hotfix\|security" v1.0..HEAD
# By parent count
git rev-list --min-parents=2 HEAD # merge commits only
git rev-list --max-parents=1 --min-parents=1 HEAD # regular commits only
git rev-list --max-parents=0 --all # root commits (orphan branches)
# Pagination
git rev-list --skip=50 --max-count=10 v1.0..HEADCross-branch analysis
bash
# Left-right markers
git rev-list --left-right main...release/2.x
# Cherry (patch-equivalent) detection
git rev-list --cherry-mark --left-right main...release/2.x
# = patch-equivalent > only on right < only on left
# Backport gap (unported hotfixes)
git rev-list --right-only --count --cherry-pick main...release/2.xTopology
bash
git rev-list --first-parent main # clean mainline
git rev-list --first-parent --count v1.0..main # mainline commit distance
git rev-list --ancestry-path v1.0..main # direct ancestry only
git rev-list --all --not HEAD # commits on other branchesProgrammatic
bash
git rev-list --stdin < sha-list.txt # read SHAs from stdin
git rev-list --format="%H %at %an" v1.0..HEAD # machine-readable
git rev-list --reverse v1.0..HEAD # oldest-first (safe apply order)
git rev-list --missing=print --all # missing objects in promisor cloneBisect cost
bash
N=$(git rev-list --count v1.0..HEAD)
echo "~$(python3 -c "import math; print(math.ceil(math.log2($N)))") bisect runs for $N commits"Common ranges
| Expression | Commits reachable from... |
|---|---|
main..feature | feature but not main |
main...feature | either but not both |
^main feature | feature but not main (same as ..) |
--all ^main | any ref except main |
HEAD -- src/api/ | HEAD, filtering to path |
--since="7 days" HEAD | HEAD, within 7 days |
Exit codes
| Exit | Meaning |
|---|---|
| 0 | Zero commits in range (or count returned) |
| 0 + SHA output | Commits found |
| 1 | Invalid refspec or range parse error |
Script
scripts/rev-list-manage.sh — supports: count, left-right, cherry-gap, merges, range, since-until, stale, bisect-cost, top-count, verify-range, touching-path, stdin-count.
Full guide: docs/devops-workflows/git-rev-list-devops.md