代码之家  ›  专栏  ›  技术社区  ›  Basile Starynkevitch

同一个git的几个作者提交?[复制]

  •  1
  • Basile Starynkevitch  · 技术社区  · 7 年前

    我熟悉的所有版本控制系统的工作方式是,每个提交都由一个开发人员负责。敏捷工程的兴起,特别是结对编程,已经导致了这样一种情况:两个开发人员对同一个任务做出了重大贡献,例如一个bug修复。

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

    0 回复  |  直到 7 年前
        1
  •  65
  •   mokagio codeWhisperer    4 年前
    Commit title
    
    Commit body
    
    Co-authored-by: name <additional-dev-1@example.com>
    Co-authored-by: name <additional-dev-2@example.com>
    

    这种方法有一个问题

    例如 Co-authored-by: Linus Torvalds <torvalds@linux-foundation.org>

    对于普通的作者或签名组(旧方法),您会看到它没有签名,并且知道您不能信任提交。但是,没有签署共同作者的程序。


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

    下面是一个带有其他临时解决方案的相关错误报告:

    Bug git-core: Git should support multiple authors for a commit

        2
  •  67
  •   Kariem    7 年前

    git惯例是使用 合著者 git kernel: Commit Message Conventions ,指 Openstack Commit Messages ). 这也是 one of the solutions git-core bug 链接到 Gerry's answer

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

    作为 Llopis GitHub在一篇评论中指出,2018年1月29日,GitHub在其博客上宣布支持此项服务: Commit together with co-authors ( details

        3
  •  28
  •   bialix    13 年前

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

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

        4
  •  20
  •   Ciro Santilli OurBigBook.com    7 年前

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

    这个简单的脚本从Pivotal到自动化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
    user.email=pair+jsusser+sam@pivotallabs.com
    

    为你。

        5
  •  13
  •   Jakub Kukul    6 年前

    git区分提交的 author committer [1] 一。你可以把它当作一个变通办法,例如,把你自己签成 作者 :

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

    git log --format=fuller ,会给你类似于:

    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?

        6
  •  4
  •   foo0x29a    5 年前

    open source project ,我是一个贡献者,在GitHub上提供了一个从命令行执行此操作的好方法。此项目帮助您设置别名,以便创建自动提交,如下所示:

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

        7
  •  3
  •   tripleee    13 年前

    作为约定,我们在每个提交消息的末尾添加我们的名字 如: Implemented cool feature <Aneesh | Hiren>

        8
  •  2
  •   Dennis    7 年前

    Try git-mob

    git mob <initials of co-authors>
    git commit
    git solo
    
        9
  •  1
  •   nsn    5 年前

    大多数合著工具不支持自动完成。你可以试试 git-coco ,它是用python3编写的(我是开发人员)。 git-coco 支持自动完成和自动建议。 这是快照 autocomplete on sample authors