My git changelog generator learned that merge commits hide the truth — parents are a graph, not a line
Описание и применение
Генератор changelog, использующий git log A..B, скрывал детали слияний. Переписав логику на --first-parent и обход графа, он теперь выводит точные изменения, включая отдельные коммиты, что повышает прозрачность релизов.
Задача
Merge commits in a typical PR workflow hide the individual feature commits, causing release notes to lack actionable information.
Результат
The updated generator produces accurate, detailed release notes that reflect the true changes shipped, improving transparency for reviewers.
Рабочий процесс
- 1. Run
git log --first-parent A..Bto list merge commits on the main branch. - 2. For each merge commit, run
git log ^parent1 parent2to list the commits merged from the side branch. - 3. Deduplicate commits that are already present on the base branch.
- 4. Emit structured release notes showing the merge as a structural event followed by the real commits underneath.
Доказательства
First version walked git log A..B and treated every commit as a straight line. Clean, deterministic, wrong.
The bug: on a repo with a normal PR workflow, git log A..B on the main branch shows merge commits but NOT the individual feature commits they brought in.
I switched to git log --first-parent A..B for the branch-level summary, then for each merge commit, git log ^parent1 parent2 to enumerate the commits that merge actually introduced.
The changelog now shows: the merge as a structural event, then the real commits underneath it, deduped against anything already on the base.
Shipped as a deterministic diff at https://x402.freeq.one/tools/changelog_git.html — no LLM rewriting your history, just the graph doing what the graph does.
- Дата записи: 2026-10-17T23:41:22.788Z