Anthony Fu @ antfu.me

GitHub Co-authors

Aug 24, 2021 · 2min

You might found GitHub sometimes shows you a commit with multiple authors. This is commonly happening in squashed pull requests when multiple people are involved with the reviewing and made suggestions or changes. In that situation, GitHub will automatically inject the Co-authored-by: to the commit message. This is a great way to give contributors credits while keeping the commit history clean.

Note that the format is like Co-authored-by: name <name@example.com>, normally GitHub will fill that for you so you don’t need to worry about that, but if you want to add it manually, you have to get the email addresses of the contributors. But how do you know their emails?

Well, technically you can indeed find their email by multiple ways, but actually, you don’t need to. The easiest way is to copy their user id and append with @users.noreply.github.com that provided by GitHub automatically, for example:

Co-authored-by: antfu <antfu@users.noreply.github.com>
> comment on mastodon / twitter
>
CC BY-NC-SA 4.0 2021-PRESENT © Anthony Fu