是否可能以及如何“给予改变信用”?对于 Mercurial/Git 来说,就像 Bazaar 一样?
Bazaar 支持添加元数据以提交记录谁是更改的实际作者是与提交更改的人相比:
$ bzr commit --author "Jane Rey <[email protected]>" \ --author "John Doe <[email protected]>"
添加此元数据后,可以通过 bzr log 访问它,例如:
------------------------------------------------------------ revno: 105661 fixes bug(s): http://debbugs.gnu.org/9414 author: Oleksandr Gavenko committer: Juri Linkov branch nick: trunk timestamp: Mon 2011-09-05 12:55:11 +0300 message: * lisp/progmodes/grep.el (rgrep): Add "-type d".
可以在 Mercurial/Git 的提交中嵌入此类元数据吗?
Bazaar support adding meta data to commit to record who the actual author of a change is vs. the person who commits the change:
$ bzr commit --author "Jane Rey <[email protected]>" \ --author "John Doe <[email protected]>"
After adding this meta data it accessible via bzr log
, like:
------------------------------------------------------------ revno: 105661 fixes bug(s): http://debbugs.gnu.org/9414 author: Oleksandr Gavenko committer: Juri Linkov branch nick: trunk timestamp: Mon 2011-09-05 12:55:11 +0300 message: * lisp/progmodes/grep.el (rgrep): Add "-type d".
It is possible embed such metadata in commit for Mercurial/Git?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 git 中你有类似的命令:
但它通常来自预先设置的配置值。
Hg 有一个类似的标志用于设置用户,但不区分作者和提交者。但有一个扩展可以做到这一点。
git 和 hg 都没有为一次提交设置多个作者的概念。尽管这通常是在团队中以某种预先确定的方式/约定在提交消息中完成的
In git you have the similar command:
But it usually comes from pre-set config values.
Hg has a similar flag for setting the user, but does not make a distinction between author and committer. But there is an extension to do that.
Both git and hg do not have the concept of setting multiple authors for a commit. Though that is usually done in the commit message in some pre-determined way / convention in the team
Mercurial 默认没有这样的能力。无法直接指定“提交者”与“作者”。同样,仅支持一位作者。
Mercurial has no such ability by default. There is no way to specify a "committer" vs an "author" directly. Similarly there is support for only one author.
此类元数据默认嵌入在 git 中。要查看它,只需尝试绑定 git log 即可。您将看到与每个提交关联的所有元数据。您可以按照本教程中的指定设置您的用户名和电子邮件。本质上,您可以像这样设置您的电子邮件和姓名:
另外, git 有一个有趣的命令,名为 blame ,它可以让你查看谁更改了具体的行。
Such metadata is embedded by default in git. To see it just try tying
git log
. You'll see all the metadata associated with each commit. You can set your username and email as specified in this tutorial. Essentially you can set your email and name like this:Also, git has a fun command called blame which lets you see who changed exactly what line.