DEV Community

Steven Keil
Steven Keil

Posted on AI-assisted

Generating Changelogs from Git Log Between Two Tags

If you've ever had to write release notes by scrolling through git log, you know the drill: squinting at commit messages, manually sorting "fix" from "feat," and copy-pasting into a Markdown file by hand.

Here's a quick way to make that less painful using only git log.

Step 1: Get the raw commits between two tags

git log v1.2.0..v1.3.0 --pretty=format:"%s"
Enter fullscreen mode Exit fullscreen mode

This gives you every commit subject line between v1.2.0 and v1.3.0. You can also use two commit hashes instead of tags if you don't tag releases.

Step 2: Group by conventional commit prefix

If your commits follow a loose convention (feat:, fix:, chore:, docs:), you can split them out with a bit of shell:

git log v1.2.0..v1.3.0 --pretty=format:"%s" | grep "^feat" > features.txt
git log v1.2.0..v1.3.0 --pretty=format:"%s" | grep "^fix"  > fixes.txt
git log v1.2.0..v1.3.0 --pretty=format:"%s" | grep "^chore" > chores.txt
Enter fullscreen mode Exit fullscreen mode

Then concatenate them under headings:

## Features
- feat: add dark mode toggle

## Fixes
- fix: correct timezone offset in export
Enter fullscreen mode Exit fullscreen mode

Step 3: Where this breaks down

This works fine for a handful of commits. It gets tedious once:

  • Commits don't follow the convention consistently
  • You have dozens of commits between tags
  • You want the same grouped Markdown format every release, without rebuilding the grep pipeline each time

That's the exact gap I built a small tool for.

My own product (it is mine and it is paid)

I made a Markdown Changelog Generator that reads the git log between two tags or commits and writes out grouped Markdown automatically, so you don't have to rebuild the grep-and-concatenate pipeline above every release.

It's 12 EUR: https://skeilster.gumroad.com/l/hdsfn

Top comments (0)