In the world of free software, it’s good to appropriately credit contributors to your community for the work they do.
git
makes this hard when you pair program. I was at a hackathon recently, and while I didn’t make a single commit, I sat next to a lot of other people who made plenty of commits based on conversations we had, and suggested a lot of things to try to debug problems, and invented solutions that made it into those commits. No highly-nutritious green squares in github for me, no external evidence that I had contributed two days of my time to these free software projects.
When I pair, if I’m committing, I make sure that I acknowledge the contribution my pair makes as equal to my own. In the github UI, it looks like this. You can see that both of us contributed to the commit.
How do I do this? I commit like this:
git commit -m 'We fixed this thing' --author 'Jennifer H. Pair <jenny.pair@example.com>'
Now both accounts are linked in the UI, because I’m the committer and my pair is the author. This isn’t perfect, because github doesn’t acknowledge the author in their contribution graph, only the committer. If there’s a more egalitarian way to acknowledge my pair I’d want to follow that, but for the moment I’m happy to at least demonstrate that they authored the change I typed into a text editor.
If you’re doing it with some regularity, there’s a git extension-ish tool called git-duet which does a great job of making a pairing modal setup for your shell
https://artsy.github.io/blog/2018/10/19/pair-programming/#Remote
I was about to link to Git Duet too but Orta beat me to it. It’s fantastic for pairing. https://github.com/git-duet/git-duet
I use a
Co-Authored-By
trailer to the commit message and this correctly attributes myself and my pairing partner(s) as authors on GitHub.Why not just use coauthors? https://github.blog/2018-01-29-commit-together-with-co-authors/
It’s expected to be adopted by git core as well.
You could also use Co-authored-by https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors
I prefer tools like git-mob which use the
Co-authored-by
trailer in commit notes. These trailers are recognised by GitHub.git-pair is a simpler script for automatically adding
Co-Authored-By
lines: https://github.com/cac04/git-pairUse the word “just” in a software context, I double my estimates.