gpt4 book ai didi

git - Git 中作者和提交者的区别?

转载 作者:IT王子 更新时间:2023-10-29 01:15:27 24 4
gpt4 key购买 nike

我正在尝试像这样提交

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

其中 John Doe 是我想以其名义进行提交的某个用户。

它在 git log 中显示正常。但是,当我执行 gitk 时,作者姓名是正确的,但是提交者姓名是从我的全局 git 配置设置中挑选的(因此设置为我的姓名/电子邮件).

问题

  1. 两者(提交者与作者)有什么区别?

  2. 我是否也应该将提交者设置为其他用户?

  3. 如果是,怎么做?

最佳答案

楼主问:

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

作者是最初编写代码的人。另一方面,假定提交者是代表原作者提交代码的人。这在 Git 中很重要,因为 Git 允许您重写历史记录,或代表其他人应用补丁。 FREE online Pro Git book解释如下:

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.

楼主问:

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

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

关于git - Git 中作者和提交者的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18750808/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com