The best software is written by teams who work well together. Collaborative coding has many proven long term benefits — more resilient code, knowledge transfer, stronger team culture, and many more. Giving credit where credit's due is a cornerstone of effective collaboration. Not only that valuable work gets acknowledged, making contributions visible can motivate people to help one another (e.g. mentoring, answering questions in slack, being quick to support). Another benefit of co-authoring is that by documenting all the parties involved in writing the code, you provide more points of contact for future inquiries.
To attribute a commit to multiple authors, add one or more lines with the format
Co-authored-by: name <email@example.com> to the end of a commit message.
An example of a co-authored commit message:
We fixed a gnarly bug together! Co-authored-by: Vanessa Yuen <firstname.lastname@example.org> Co-authored-by: Katrina Uychaco <email@example.com>
Tip: Your collaborator might have chosen to keep their email private, please respect that by only using their GitHub provided
no-reply email address in the commit message. Otherwise, their personal email will be exposed to everyone who has access to the repository. To find your
no-reply email address, go to your GitHub Settings > Emails, then navigate to "Keep my email address private" option.
For a step-by-step guide on adding co-authors on GitHub, see this GitHub Help article.
In order for co-authored commits to be properly recognized, the format of the
Co-authored-by trailer has to be exact, which can get tedious. Using a graphical git tool, such as Atom or GitHub Desktop, can streamline this step, making it easier to share credits.
Co-authoring in Atom
Co-authoring in GitHub Desktop
Pair programming is an obvious use case for committing with co-authors, but there are a lot more opportunities for giving credits:
Hopefully, you have found some inspiration from the article. Look out for the next opportunity to delight your teammates by adding them as co-authors. If you can think of more creative ways to use co-authoring, please comment below. Happy social coding!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.