Git Intelligence in a Minute
Branch Comparison
Comparing two branches as evidence of divergence—commits unique to each side and the aggregated diff.
In one sentence
Branch comparison describes how two Git refs differ: which commits each has that the other lacks, and what file changes that implies.
Why it matters
Release branches, agent worktrees, and long-lived feature branches drift. Comparison answers “what is different?” before merge or cherry-pick decisions.
How it works
- Name both refs clearly (e.g., main and release/2.4).
- List commits on A not in B and on B not in A.
- Inspect git diff A...B for the merge-base-aware change set when preparing a merge.
- Call out renames, binary files, and dependency lock churn separately.
Example
git log --oneline main..feature/search git log --oneline feature/search..main git diff --stat main...feature/search
The two log ranges show unique commits each way; the three-dot diff shows changes since the merge base.
What this proves
Branch comparison proves commit and file differences between two refs under Git’s history graph.
What this does not prove
It does not prove which branch is “correct,” that CI passed on both, or that production matches either tip.
Last reviewed 2026-09-06. Title for citation: Git Intelligence in a Minute: Branch Comparison.