Why should we code collaboratively?
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.
Commit with co-authors
To attribute a commit to multiple authors, add one or more lines with the format Co-authored-by: name <firstname.lastname@example.org> 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 <email@example.com>
Co-authored-by: Katrina Uychaco <firstname.lastname@example.org>
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.
Co-author in a graphical user interface
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
When to give credit
Pair programming is an obvious use case for committing with co-authors, but there are a lot more opportunities for giving credits:
Product manager or designer gave you insightful feedback to improve user experience? Add them as a co-author!
A teammate gave you pointers to get unstuck? They deserve credit!
Received helpful code review? Acknowledge the reviewer! (Much like what happens when you accept a suggested change on a pull request.)
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!
J. Vanhanen and C. Lassenius, "Effects of pair programming at the development team level: an experiment," 2005 International Symposium on Empirical Software Engineering, 2005., Noosa Heads, Qld., 2005, URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=1541842&isnumber=32923.
Jo E. Hannay, Tore Dybå, Erik Arisholm, Dag I.K. Sjøberg, "The effectiveness of pair programming: A meta-analysis," Information and Software Technology, Volume 51, Issue 7, 2009, Pages 1110-1122, ISSN 0950-5849, URL: http://www.sciencedirect.com/science/article/pii/S0950584909000123.
... View more