Git中作者和提交者有什么区别? [英] What is the difference between author and committer in Git?

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

问题描述

我在GitHub上遇到以下提交:
https://github.com/felixge / node-formidable / commit / 0a0b150668daa3c6f01626d2565b898e5da12392



如何让多个作者在同一个提交上执行?

解决方案

这不是两个作者 - 这是作者和提交者。这两个领域有不同的含义。作者是创建内容的人,提交者是实现它的人。当你做一个正常的提交时,你都是。 (并且都带有相关的电子邮件和时间戳)。但是它们可以通过几种关键方式变得不同:


  • git format-patch / git am - 这一对可以让你把补丁变成补丁,通常通过电子邮件提交,然后让其他人应用补丁。你仍然是作者;应用他们的人是提交者。这是github上发生的事情。

  • git commit --amend git rebase 。这些都是历史重写的基本变体,从单一承诺到分支历史到整个历史。他们可能会修改comitter信息 - 特别是,他们总是重写c​​ommitter timestamp 。原作者保持原样(在默认操作模式下),如果作者也是进行重写的作者,他们的姓名和电子邮件将保留,但时间戳自然不同。



I just came across the following commit on GitHub: https://github.com/felixge/node-formidable/commit/0a0b150668daa3c6f01626d2565b898e5da12392

How does one go about having multiple authors on the same commit like that?

解决方案

That's not really two authors - that's an author and a committer. The two fields have different meanings. The author is the one who created the content, and the committer is the one who committed it. When you do a normal commit, you are both. (And both come with an associated email and timestamp.) But they can become different in a few key ways:

  • git format-patch/git am - this pair lets you turn commits into patches, generally submitted by email, then have someone else apply them. You remain the author; the person who applies them is the committer. This is pretty definitely what happened on github there.

  • git commit --amend, git rebase, git filter-branch. These are all basically variants on history rewriting, ranging from single commit to some history of a branch to the entire history. They can potentially modify the comitter information - in particular, they always rewrite the committer timestamp. The original author remains in place (in default modes of operation), and if the author is also the one doing the rewriting, their name and email stay, but the timestamp is naturally different.

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

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