git-chglog

A Tool to generate CHANGELOG.md by commit messages.

git-chglog --config .chglog/config.yml --output CHANGELOG.md 1.2.0..
style: gitlab
template: CHANGELOG.tpl.md
info:
  title: CHANGELOG
  repository_url: https://github.com/xandeer/hs.git
options:
  commits:
    filters:
      Type:
        - Feat
        - Fix
        - Refactor
  commit_groups:
    group_by: Type
    sort_by: Title
    title_maps:
      Feat: Features
      Fix: Bug Fixes
      Refactor: Code Refactoring
  header:
    pattern: "^(\\w*)\\:\\s(.*)$"
    pattern_maps:
      - Type
      - Subject
  notes:
    keywords:
      - BREAKING CHANGE
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} ([{{ .Hash.Short }}]({{ $.Info.RepositoryURL }}/commit/{{.Hash.Long }}))
{{ end -}}
{{ end }}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} ([{{ .Hash.Short }}]({{ $.Info.RepositoryURL }}/commit/{{.Hash.Long }}))
{{ end }}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/tags/{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}