How to assign one commit to multiple developers?

Like all version control systems I am familiar with working with is that each commit refers to one developer. The growth of Agile Engineering and, in particular, pair programming has led to a situation where two developers have made a significant contribution to the same task, for example, error correction.

The attribution problem will not be too big a problem in the working environment, because the project manager will know about the work done in pairs, but how about two open source participants decide to connect and click to bring some code to a specific project that they don’t know that they work together. Is there a way for a version control system such as Git to assign a specific patch to multiple developers?

+76
git version-control svn bazaar
Sep 16 '11 at 8:38
source share
8 answers
Commit title Commit body Co-Authored-By: name <additional-dev-1@example.com> Co-Authored-By: name <additional-dev-2@example.com> 

Github supported: https://github.blog/2018-01-29-commit-together-with-co-authors/ Still waiting for Gitlab: https://gitlab.com/gitlab-org/gitlab-ce/issues/ 31640 Used by others: https://git.wiki.kernel.org/index.php/CommitMessageConventions

One of the problems with this approach is that you cannot create a signed key for this group of developers, so you can add someone to this list even if they don’t work with any function and github will handle it like this as if they were doing it. However, this should not be a problem in most cases.

e.g. Co-Authored-By: Linus Torvalds <torvalds@linux-foundation.org>

With regular authors or signers (the old method), you will see that it is not signed, and you know that you cannot trust the commit. However, there is no co-authoring process.




Basically obsolete answer:

One solution would be to set a name for the pair:

 git config user.name "Chris Wilson and John Smith" 

Here is a related bug report with other workarounds:

Git-core bug: Git must support multiple authors for commit

+24
Sep 16 2018-11-11T00:
source share

The git convention is to use Co-Authored-By at the end of the commit message ( git core: Commit message conventions that reference Openstack commit messages ). This is also one of the solutions to the git-core issue related to Jerry's answer.

 Co-authored-by: Some One <some.one@example.foo> 

In this comment of May 5, 2010, Josh Triplett also suggests implementing related support in git.

As Llopis noted in his comment, GitHub announced support for this on his blog January 29, 2018: Commit together with co-authors ( details ).

+60
Jan 25 '17 at 9:01
source share

For the bazaar:

 bzr commit --author Joe --author Alice --author Bob 

These names will appear in the log separately from the name of the committer.

+23
Sep 16 2018-11-11T00: 00Z
source share

Git couple

https://github.com/pivotal/git_scripts#git-pair

This is a simple Pivotal script to automate the attribution of a Git pair.

You create a .pairs file for example:

 # .pairs - configuration for 'git pair' pairs: # <initials>: <Firstname> <Lastname>[; <email-id>] eh: Edward Hieatt js: Josh Susser; jsusser sf: Serguei Filimonov; serguei email: prefix: pair domain: pivotallabs.com # no_solo_prefix: true #global: true 

and then:

 git pair sp js 

sets:

 user.name=Josh Susser & Sam Pierson user.email=pair+jsusser+sam@pivotallabs.com 

for you.

+18
Sep 12 '14 at 15:02
source share

git distinguishes between author commits and committer [1]. You can use it as a workaround, for example, sign yourself as a committer and your co- author as author :

 GIT_COMMITTER_NAME='a' GIT_COMMITTER_EMAIL='a@a' git commit --author 'b <b@b>' 

This way, both you and your collaborator will be recorded in the Git story. Running git log --format=fuller will give you something like:

 commit 22ef837878854ca2ecda72428834fcbcad6043a2 Author: b <b@b> AuthorDate: Tue Apr 12 06:53:41 2016 +0100 Commit: a <a@a> CommitDate: Tue Apr 12 09:18:53 2016 +0000 Test commit. 

[1] Difference between author and committer in Git?

+12
May 11 '16 at 12:11
source share

We add our names to each commit message at the end as an agreement, for example: Implemented cool feature <Aneesh | Hiren> Implemented cool feature <Aneesh | Hiren>

+2
Sep 16 2018-11-11T00:
source share

Try git-mob , we created it to assign collaborators to commits.

for example

 git mob <initials of co-authors> git commit git solo 
+2
Apr 08
source share

Alternatively, there is an open source project on GitHub that provides a good way to do this from the command line. This project helps you set an alias to create collaborative commits as follows:

$ git co-commit -m "Commit message" --co "co-author <co-author-email>"

Using this approach, you can create co-authors of commits without a graphical interface.

+2
Jun 10 '18 at 23:17
source share



All Articles