GitHub has started supporting multiple commit authors. The new feature is meant to improve collaboration from several developers on the same commits or pulls requests and ensures every author gets attribution of their commits in their profile contributions graph and the repository’s statistics.
According to GitHub, the new feature responds to a growing needs in organizations where collaborative coding is the norm to speed up onboarding of junior developers, to improve code quality through peer programming or code reviews, etc.
To attribute a commit to multiple authors, developers can now add one or more "Co-authored-by" trailers to the commit message, without forgetting to include a leading blank line, for example:
Commit message
Co-authored-by: name <name@example.com>
Co-authored-by: another-name <another-name@example.com>"
It is important to note that co-author email addresses must match the email addresses associated to their accounts, otherwise they will be ignored. Furthermore, co-authors’ email addresses are shown in commit messages, so if you want to keep those email addresses private, you should use a noreply
GitHub email address.
To find out which email address you associated to your GitHub account, you can go to your account Settings, then check the Emails section. You can have multiple addresses associated to an account, just make sure the email addresses you are using in the "Co-authored-by" trailers match any of those listed there. On the same page you can also enable the option to keep your email address private, which will replace your public email address with a noreply
one.