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

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

问题描述

我刚刚在 GitHub 上发现了以下提交:https://github.com/felixge/node-formidable/commit/0a0b150668daa625c62f>8256282082528208252820p

如何让多个作者同时进行这样的提交?

解决方案

这并不是真正的两个作者 - 这是一个作者和一个提交者.这两个字段具有不同的含义.作者是创建内容的人,提交者是提交内容的人.当你做一个正常的提交时,你们都是.(两者都带有关联的电子邮件和时间戳.)

但它们可以在几个关键方面变得不同:

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

  • git commit --修改git rebase, git filter-branch - 这些基本上都是历史重写的变体,从单次提交到某个分支的某个历史记录,再到整个历史记录.他们可能会修改提交者信息——特别是,他们总是重写提交者时间戳.原作者保持原位(默认操作模式下),如果作者也是重写者,他们的姓名和电子邮件保持不变,但时间戳自然不同.

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 committer 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天全站免登陆