Git中作者和提交者之间的区别? [英] Difference between author and committer in Git?

查看:1466
本文介绍了Git中作者和提交者之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个类似于

的提交

  git commit --author =John Doe< john@doe.com> -m<通常提交消息> 

其中John Doe是我想要进行提交的用户名。



它好像在 git log 中。然而,当我做一个 gitk 作者姓名是正确的,但提交者的名字是从我的全局git配置设置中选取的设置为我的名字/电子邮件)。



问题




  1. 是两者之间的区别(提交者与作者)?

  2. 我应该设置提交者以及其他用户吗?

  3. >
  4. 如果是,如何?

  5. 原始海报问:


    两者(提交者vs作者)有什么区别?


    作者是最初编写代码的人。另一方面,提交者被认为是代表原作者提交代码的人。这在Git中很重要,因为Git允许您重写历史记录,或代表另一个人应用修补程序。 免费在线 Pro Git 可以解释它像这样:


    您可能想知道作者提交者作者是最初编写补丁的人,而提交者是上次应用补丁的人。因此,如果您向项目发送补丁并且其中一位核心成员应用此补丁,则您都会获得信任 - 您是作者,核心成员是提交者。




    原始海报问:


    我应该如何设置提交者用户?

    不,如果你想说实话,你不应该把提交者设置给作者,除非作者和提交者确实是同一个人。


    I am trying to make a commit like

    git commit --author="John Doe <john@doe.com>" -m "<the usual commit message>"
    

    where John Doe is some user in whose name I want to make the commit.

    It appears all right in git log. However, when I do a gitk, the author name is correct, but the committer name is picked from my global git config settings (and is thus set to my name/email).

    Questions

    1. What is the difference between the two (committer vs author)?

    2. Should I be setting the committer as well to the other user?

    3. If yes, how?

    解决方案

    The original poster asks:

    What is the difference between the two (Committer vs author)?

    The author is the person who originally wrote the code. The committer, on the other hand, is assumed to be the person who committed the code on behalf of the original author. This is important in Git because Git allows you to rewrite history, or apply patches on behalf of another person. The FREE online Pro Git book explains it like this:

    You may be wondering what the difference is between author and committer. The author is the person who originally wrote the patch, whereas the committer is the person who last applied the patch. So, if you send in a patch to a project and one of the core members applies the patch, both of you get credit — you as the author and the core member as the committer.

    The original poster asks:

    Should I be setting the committer as well to the other user?

    No, if you want to be honest, you should not be setting the committer to the author, unless the author and the committer are indeed the same person.

    这篇关于Git中作者和提交者之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆