git: co-authored by

1
Co-authored-by: <[email protected]>

You can attribute a commit to more than one author by adding one or more Co-authored-by trailers to the commit’s message. Co-authored commits are visible on GitHub and can be included in the profile contributions graph and the repository’s statistics.

Source: github

Co-author feature on github allows more than one author to be attributed to a commit. But for what purpose? If we consider the purpose of the origial Author: field of a git commit it has a number of purposes:

  1. Credit: Understanding who created the commit, recognising the work, and padding their commit stats and graph.
  2. Responsibility: Understanding who created the code, who is responsible for it, and who is the go-to for it.

I suggest that credit is vanity (vanity we all require, as recognition) and adds value to the individual, and that responsibility adds value to the team and codebase, not the individual.

It’s hugely important that when we write code, we deeply understand the code that we write and what it does. There’s a saying in opensource that I first read in this tweet featured on jess frazelle’s blog:

This applies not only to open source code. But also the code that we are merging into our companies repos. If we do not deeply understand how the code works and how it achieves the desired effect how can that code possibly pass the test of “forever”. This becomes even more important for bug “fixes”, a fix is not a fix if we do not understand what the bug is and how the code fixes it; observing the desired outcome does not constitute a fix.

If we accept that code must be fully understood, we can say that there’s an element of responsibility for that code that must lie somewhere. (It’s debatable as to if shared “team responsibility” can work partly due to social loafing). The responsibility for the commit must start with the commit author.

Responsibility is not something that we should shy away from, it’s empowering and enabling and adds value to teams. Credit (or kudos) add value to the individual, which is not to be ignored but shouldn’t be encouraged at the expense of team value.

Let’s consider what we are trying to achieve with Co-authored-by:. The description given in the quote at the top, from the github, talks only in terms of: credit, acknowledgement and contributions. There are alternative and better methods of acknowledging contribution to commits that are not the Author: or Co-authored-by: fields.

We should allow the Author: to set the expectations of responsibility. Credit and acknowledgement can be achieved in other ways (golang contributions example).