Pair programming is more popular than ever. The benefits are clear: greater knowledge-sharing, less mental fatigue and better code, to name a few. It seems that the trend toward more collaborative coding will only grow in the future. In light of this, GitHub announced in late January 2018 that it now supports co-authored commits.
Prior to this ability, pair programming meant that your GitHub activity would only reflect the commits which you personally made. When your partner was driving and you were navigating, your contribution was not recognized. With frequent role switching, this may not seem to matter all that much. The fact is, though, that you each only got half the credit you deserved. With co-authored commits, you both get full credit for every commit. And there doesn’t seem to be a limit on the number of co-authors, allowing for even more collaborative contributions (perhaps a whole class working together on a project).
Taking advantage of this new feature is easy. The exact steps depend on where you make your commit (command line, website, or desktop app), but the process is essentially the same. After your commit message, add a “trailer” with the following format:
Co-authored-by: Partner Name [email protected]
Just make sure you leave a blank line before the Co-authored-by, and you should be all set. See the official GitHub help document if you need more specific instructions.
Now that you know how, start co-authoring your commits today!