Skip to content

changelog does not include body or footer information #746

Description

@jlanzarotta

Description

When generating a changelog where commits contain conventional commits, the body (the extended commit information) along with the footer information (ticket references information, etc.) is not written to the output file.

Steps to reproduce

cz changelog

Current behavior

Commits that have body and footer information, have this information missing from the changelog.

Desired behavior

Commits that have body and footer information, would have this information shown in the changelog.

Screenshots

No response

Environment

  • commitizen version 3.2.2

Activity

  1. AGiantSquid commented on Jun 4, 2024

    @AGiantSquid

    It is possible to add the body and footer information by customizing the config_parser regex and the template.

    For example, set up a cz.yaml file with something like this:

    ---
    commitizen:
      customize:
        commit_parser: ^((?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE)(?:\((?P<scope>[^()\r\n]*)\)|\()?(?P<breaking>!)?|\w+!):\s(?P<subject>[^\n]*)(?P<body>(?:\n(?!Refs:|:\s#)[^\n]*)*)(?:\n(?P<footer>(?:Refs:[\s\S]*)?))?$
      name: cz_customize
      tag_format: v$version
      update_changelog_on_bump: true
      version_provider: npm
      version_scheme: semver
      template: CHANGELOG.md.j2
    

    The commit_parser will parse your commit, and make the capture groups available to your formatter. In the regex string above, we're getting a section after the subject and labeling it "body", and getting any content that starts "Refs: " and labeling it footer.

    You can then create a template CHANGELOG.md.j2 like this:

    {% for entry in tree %}
    {% set entry_title -%}
    {{ entry.version }}{% if entry.date %} ({{ entry.date }}){% endif -%}
    {%- endset %}
    
    {{ entry_title }}
    {{ "=" * entry_title|length }}
    
    {% for change_key, changes in entry.changes.items() %}
    {% if change_key %}
    {{ change_key }}
    {{ "-" * change_key|length }}
    {% endif %}
    
    {% for change in changes %}
    {% if change.footer %}
    {% set ticket = change.footer.split('#')[1] %}
    {% endif %}
    {% set ticket_link = "[[" + ticket + "](https://blah.atlassian.net/browse/" + ticket + ")] " if ticket else ""  %}
    {% set commit_link = "[" + change.sha1[:7] + "](" + change.sha1 + ")" %}
    {% set scope = "**" + change.scope + "**: " if change.scope else ""  %}
    - {{ ticket_link }}{{ scope }}{{ change.subject }} {{commit_link}}
    {% if change.body %}
    {% set lines = change.body.split('\n') %}
    {% for line in lines %}
    {% set stripped_line = line.strip() -%}
    {% if stripped_line.startswith('-') %}
        {{ stripped_line }}
    {% elif stripped_line %}
        - {{ stripped_line }}
    {% endif %}
    {% endfor %}
    {% endif %}
    {% endfor %}
    
    {% endfor %}
    {% endfor %}
    

    Which will use the capture groups subject body and footer from the commit_parser is the cz.yaml.

    Adjust the regex according to your commit formatting:

    image
  2. bearomorphism commented on May 9, 2026

    @bearomorphism
    Collaborator

    Triage from #1964: Body and footer aren't included by default — only the title is captured by cz_conventional_commits's default commit_parser. To include them, you can write a custom changelog_message_builder_hook or override commit_parser to capture body groups. Suggesting we relabel as type: feature (changelog template support for body/footer) or close as documented limitation.

  3. bearomorphism commented on May 9, 2026

    @bearomorphism
    Collaborator

    Verification update (re #1964)

    Reproduced against current master (4.15.1):

    Made a commit with the form

    feat: add new feature
    
    This is the body explaining the feature in detail.
    It spans multiple lines.
    
    Refs: TICKET-123
    Reviewed-by: someone
    

    cz changelog --dry-run output:

    ## Unreleased
    
    ### Feat
    
    - add new feature

    The body and footer are dropped — only the title's subject (after the type) appears.

    Verdict: STILL VALID as documented behaviour, but I'd argue this is a reasonable feature gap rather than a bug.

    The default commit_parser in cz_conventional_commits only captures the type, scope, and subject. To include body/footer, users currently need to:

    1. Override commit_parser with a regex that captures body / footer named groups, AND
    2. Use a custom Jinja template (or changelog_message_builder_hook) that renders those groups.

    A small UX win would be to add a top-level config option like changelog_include_body = true that automatically swaps in a richer parser + template, so non-Python users don't need to write a hook just to render full commit info.

    Suggesting we relabel as type: feature and either implement the convenience flag, or close with a docs link to the customization guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions