You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By (optionally) changing the template to skip commit hashes for unreleased commits, it becomes possible to integrate Jilu in a post-commit workflow that automatically amends your commits with the updated changelog.
Without this feature, the amended changes will cause the commit hash to change, and thus you'll have to update the change log again, going into an endless loop.
This is already possible, but requires you to add a custom template to your CHANGELOG.md with these parts updated/removed:
{%- for change in unreleased.changes -%}
- {{ change.type }}: {{ change.description }} ([`{{ change.commit.short_id }}`])
{% endfor %}
{% for change in unreleased.changes %}
[`{{ change.commit.short_id }}`]: {{ url }}/commit/{{ change.commit.id }}
{%- endfor -%}
You can then use a .git/hooks/post-commit hook such as this one:
#!/bin/sh# Update CHANGELOG.md with latest commit message.
jilu | sponge CHANGELOG.md
# No changes detected.
git diff --quiet --exit-code CHANGELOG.md &&exit 0
git add CHANGELOG.md
# We have to manually disable this hook or else we'll get into a loop. There is# no way to disable "post-commit" hooks using the Git CLI.
gitdir="$(git rev-parse --git-dir)"
hook="$gitdir/hooks/post-commit"
[ -x"$hook" ] && chmod -x "$hook"
git commit --no-verify --amend --no-edit --quiet
chmod +x "$hook"echo"$(git rev-parse --short HEAD): CHANGELOG.md update amended"
The text was updated successfully, but these errors were encountered:
An alternative (better?) approach is to change the template to keep the links to all commits except for the latest (unreleased) change. The last one will get a link pointing to "HEAD", so that it doesn't need a rewrite when the hook runs.
By (optionally) changing the template to skip commit hashes for unreleased commits, it becomes possible to integrate Jilu in a
post-commit
workflow that automatically amends your commits with the updated changelog.Without this feature, the amended changes will cause the commit hash to change, and thus you'll have to update the change log again, going into an endless loop.
This is already possible, but requires you to add a custom template to your
CHANGELOG.md
with these parts updated/removed:You can then use a
.git/hooks/post-commit
hook such as this one:The text was updated successfully, but these errors were encountered: