Tip: How to add multiple authors to a commit

Git, Github, Programming, Web development · Jun 12, 2021

You can add multiple authors to a git commit, by adding one or more Co-authored-by trailers to the commit's message:

$ git commit -m "Refactor usability tests.
Co-authored-by: name <name@example.com>
Co-authored-by: another-name <another-name@example.com>"
  • To correctly attribute a commit to a co-author, you must use the email associated with their GitHub account.
  • If a person's email is private, you can use their GitHub-provided no-reply email.
  • Leave one or preferably two empty lines before any Co-authored-by trailers.

Written by Angelos Chalaris

I'm Angelos Chalaris, a JavaScript software engineer, based in Athens, Greece. The best snippets from my coding adventures are published here to help others learn to code.

If you want to keep in touch, follow me on GitHub.

More like this