2011-09-16 63 views
57

我熟悉的所有版本控制系统的工作方式是每个提交都归属于一个开发人员。敏捷工程的兴起,特别是结对编程,已经导致两个开发人员为同一项任务作出重大贡献的情况,例如错误修复。如何将单个提交归因于多个开发人员?

在工作环境中,归因问题不会太大,因为项目经理会意识到配对正在进行的工作,但如果两个开源贡献者决定配对,推出一些代码给一个不知道他们在一起工作的特定项目。像Git这样的版本控制系统有没有办法将特定的补丁分配给多个开发人员?

+8

这应该针对每个版本控制系统进行拆分。 –

回答

2

我们我们的名字添加到每个提交消息在最后作为一个约定 例如:Implemented cool feature <Aneesh | Hiren>

+3

这与我在[单独的答案](http://stackoverflow.com/a/41847267/12039)中提到的git convention'Co-Authored-By'类似 – Kariem

17

对于市场:

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

这些名称将与提交者名称分开显示在日志中。

19

混帐对

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

从枢纽这个简单的脚本来自动Git的结对编程的归属。

您创建一个.pairs文件,如:

# .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 

然后:

git pair sp js 

集:

user.name=Josh Susser & Sam Pierson 
[email protected] 

你。

8

我认为git缺乏这样的功能。但是,git区分了提交的authorcommitter [1]。您可以将其用作解决方法,例如签署自己的committer和您的合着者为author

GIT_COMMITTER_NAME='a' GIT_COMMITTER_EMAIL='[email protected]' git commit --author 'b <[email protected]>' 

这样一来,您和您的合着者将被记录在git的历史。运行git log --format=fuller,会给你这样的:

commit 22ef837878854ca2ecda72428834fcbcad6043a2 
Author:  b <[email protected]> 
AuthorDate: Tue Apr 12 06:53:41 2016 +0100 
Commit:  a <[email protected]> 
CommitDate: Tue Apr 12 09:18:53 2016 +0000 

    Test commit. 

[1] Difference between author and committer in Git?

20

一个Git约定是使用共同撰写,通过在提交信息(git kernel: Commit Message Conventions结束,指的是Openstack Commit Messages )。这也是one of the solutions上链接的git-core bugGerry's answer

Co-authored-by: Some One <[email protected]> 

在该意见于2010年5月5日,约什 - 普雷特还建议实施相应的Git支持。

由于Llopis在评论中指出,GitHub于2018年1月29日在其博客上宣布支持此操作:Commit together with co-authorsdetails)。

+1

这是现在[支持](https:// help.github.com/articles/creating-a-commit-with-multiple-authors/)通过GitHub。 – Llopis

+0

@Llopis刚刚看到博客文章,来到这里更新我的答案。很高兴看到有人更快:) – Kariem

相关问题