Generate changelogs from git history. Use when the user asks to create a changelog, release notes, or summarize changes between tags, branches, or date ranges. Triggers on 'changelog', 'release notes', 'what changed', 'diff summary'.
Generate structured changelogs from git commit history using conventional commits.
/changelog # since last tag
/changelog v1.2.0..v1.3.0 # between tags
/changelog --since="2 weeks ago" # date range
/changelog main..feature-branch # branch diff
Parse user input to determine the git range:
# Default: last tag to HEAD
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$LAST_TAG" ]; then
RANGE="$LAST_TAG..HEAD"
else
RANGE="HEAD~50..HEAD" # fallback: last 50 commits
fi
# User-specified range
RANGE="v1.2.0..v1.3.0"
# Date-based
git log --after="2025-01-01" --before="2025-02-01" --oneline
# Get conventional commit log with authors
git log $RANGE --pretty=format:"%h|%s|%an|%ad" --date=short
# Include PR numbers if available
git log $RANGE --pretty=format:"%h|%s|%an" --grep="(#[0-9]*)"
Group commits by conventional commit prefix:
| Prefix | Category | Emoji |
|---|---|---|
feat: | Features | n/a |
fix: | Bug Fixes | n/a |
perf: | Performance | n/a |
refactor: | Refactoring | n/a |
docs: | Documentation | n/a |
test: | Tests | n/a |
ci: | CI/CD | n/a |
chore: | Maintenance | n/a |
BREAKING CHANGE | Breaking Changes | n/a |
Commits without conventional prefix: categorize by analyzing the message.
For each commit, optionally:
#123 -> [#123](https://github.com/org/repo/pull/123)fixes #456 -> [#456](https://github.com/org/repo/issues/456)Detect repo origin for links:
REMOTE_URL=$(git remote get-url origin 2>/dev/null)
Default format: Markdown
# Changelog
## [v1.3.0] - 2025-02-05
### Breaking Changes
- Description of breaking change (#PR)
### Features
- Add user authentication flow (#123) - @author
- Support batch processing for imports (#124) - @author
### Bug Fixes
- Fix race condition in session handler (#125) - @author
### Performance
- Optimize database query for user lookup (#126) - @author
### Contributors
@author1, @author2, @author3
| Flag | Effect |
|---|---|
--format=md | Markdown (default) |
--format=json | JSON output |
--format=slack | Slack-friendly format |
--no-links | Skip PR/issue linking |
--no-authors | Omit contributor attribution |
--breaking-only | Only show breaking changes |
--include-merge | Include merge commits (excluded by default) |
When --format=slack or user asks for Slack-friendly output:
*Release v1.3.0* (2025-02-05)
*Breaking Changes*
- Description of breaking change (<link|#PR>)
*Features*
- Add user authentication flow (<link|#123>)
*Bug Fixes*
- Fix race condition in session handler (<link|#125>)
{
"version": "v1.3.0",
"date": "2025-02-05",
"range": "v1.2.0..v1.3.0",
"categories": {
"breaking": [],
"features": [],
"fixes": [],
"performance": [],
"other": []
},
"contributors": [],
"stats": {
"total_commits": 42,
"files_changed": 87,
"insertions": 1234,
"deletions": 567
}
}
git log -- path/Co-authored-by trailers