当一个git提交有多个父母时,计算的统计数据是什么? [英] When a git commit has multiple parents, what are the stats calculated against?

查看:111
本文介绍了当一个git提交有多个父母时,计算的统计数据是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当提交包含多个父母时,如这一个,我们看到它有 4个新增 4个删除。我的问题是比较什么?在文件中增加和删除的内容是否与它们在父母中的存在相比?或者如何进行比较?

解决方案

这是一个三方合并:





(您可以在此查看另一个三向合并示例答案)根据惯例,GitHub将始终显示父母:

    $ b $ b
  • 第一个父级,即您合并时所在的分支

  • 和第二个父级,即您合并分支中的提交。
  • >


与这两个提交的共同祖先相比,第二个合并到第一个提交时,会带来4个添加和4个删除。 p>

When a commit has multiple parents, like this one, we see that it has 4 additions and 4 deletions. My question is compared to what? Are the additions and deletions compared to the file as it existed in BOTH parents? Or how exactly is it compared?

解决方案

It is a three-way merge between:

(you can see another example of three-way merge in this answer)

By convention, GitHub will always display the parents as:

  • The first parent, which is the branch you were on when you merged,
  • and the second parent, which is the commit on the branch that you merged in.

Compared to the common ancestor of those two commits, the second one, when merged into the first one, brings 4 additions and 4 deletions.

这篇关于当一个git提交有多个父母时,计算的统计数据是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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