Skip to content

How to recreate Github squash commit message Co-authored-by trailer with commit template? #4636

Answered by thomaseizinger
melink14 asked this question in Q&A
Discussion options

You must be logged in to vote

I think I was just able to simplify this down to:

{# Here comes some fancy Jinja2 stuff for correctly attributing co-authorship: #}
{% for commit in (commits | unique(False, 'email_author')) | rejectattr("author", "==", author) %}
  {% if commit.parents|length == 1 %}
Co-Authored-By: {{ commit.author }} <{{ commit.email_author }}>
  {% endif %}
{% endfor %}
{# GitHub requires that the `Co-authored-by` lines are AT THE VERY END of a commit, hence nothing must come after this. #}

Replies: 3 comments 17 replies

Comment options

You must be logged in to vote
1 reply
@jd
Comment options

Comment options

You must be logged in to vote
13 replies
@thomaseizinger
Comment options

@thomaseizinger
Comment options

@thomaseizinger
Comment options

@thomaseizinger
Comment options

Answer selected by jd
@thomaseizinger
Comment options

@jd
Comment options

@thomaseizinger
Comment options

@jd
Comment options

Comment options

You must be logged in to vote
3 replies
@jd
Comment options

@DouglasBlackwood
Comment options

@thomaseizinger
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants