Programming Languages

GitHub Adds Crediting for Multiple Co-Authors on a Single Commit

29 Jan 2018 2:10pm, by

In dev life there few things as satisfying as filling in those little green squares on your GitHub contribution graph. When working on a team project, though, sometimes that little green square gets credited as someone else’s commit even if several people contributed equally to the work.

As of today, though, GitHub now supports multiple commit authors. In a world of ever more thorough code reviews of ever more complex — and collaborative — open source projects, it is now possible to see exactly how many fingers contributed to any particular piece of the pie (and exactly who those fingers belonged to).

Now, developers can easily see who has contributed to every commit — regardless of how many contributors there are. And every contributor gets attribution, both in the pull request and in their contribution graph.

It’s dead easy to do, too. It starts with the usual commit message. Then, to add co-contributors to any commit, just create one line of white space — this lets GH know more is coming, commit-wise — and then add one or more “co-authored-by” trailers to the end of the commit message. The format is “Co-authored-by Full Name <an.email@anEmailAddress>”. The only catch is that the included email for each co-author must be the one associated with their GitHub account for the attribution to work.

The new commit and all its co-authors will appear on GH the next time you push. That’s all it takes! Now let the credits roll…

Pro tip: It can be surprisingly tricky to track down a GH-associated email address. You can help a co-author find their preferred email address by sharing this information:

  • To find your GitHub-provided no-reply email, navigate to your email settings page under “Keep my email address private.”
  • To find the email you used to configure Git on your computer, run git config user.email on the command line.

A newsletter digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.