The way all version control systems I'm familiar with work is that each commit is attributed to a single developer. The rise of Agile Engineering, and specifically pair programming, has lead to a situation where two developers have made a significant contribution to the same task, a bug fix for example.
The issue of attribution won't be too much of a big deal in a work environment since the project manager will be aware of the work the pairs are doing, but what about if two open source contributors decide to pair up and push out some code to a particular project that has no idea they're working together. Is there any way for a version control system like Git to attribute a particular patch to multiple developers?
I think that git lacks such a feature. However, git distinguishes between a commit's
author
andcommitter
[1]. You can use it as a work-around, e.g. sign yourself as thecommitter
and your co-author as theauthor
:This way, both you and your co-author will be recorded in the git history. Running
git log --format=fuller
, will give you something like:[1] Difference between author and committer in Git?
git-pair
https://github.com/pivotal/git_scripts#git-pair
This simple script from Pivotal to automate Git pair programming attribution.
You create a
.pairs
file like:and then:
sets:
for you.
Alternatively, there is an open source project on GitHub that provides a good way to do it from the command line. This project helps you to set an alias in order to create co-autored commits as follows:
$ git co-commit -m "Commit message" --co "co-author <co-author-email>"
Using this approach, you are able to create co-authored commits without a graphical interface.
Try git-mob, we built it for attributing co-authors on commits.
E.g.
One solution would be to set a name for the pair:
Here is a related bug report with other temporary solutions:
Bug git-core: Git should support multiple authors for a commit
For Bazaar:
Those names will be shown in the log separately from committer name.