git merge: 新的提交是重要的吗?

huangapple go评论87阅读模式
英文:

git merge: Does it matter which commit is newer?

问题

无论A或B是更近的提交,合并B到A都会得到相同的结果,与时间戳无关。

英文:

Suppose I have two commmits, A and B. Suppose I am merging B into A. Does it matter whether A or B is the more recent commit? Or will I get the same result independent of the timestamps?

答案1

得分: 2

在时间戳独立的情况下,我会得到相同的结果吗?

是的。合并是通过同时在两边执行自从两边分歧点以来的“更改”来完成的。两边的权重完全相同。它不管它们在时间上如何关联或哪一边合并到哪一边。

然而,一个常见的困惑源是没有意识到一边没有变化意味着没有贡献。如果分歧点有Hey,而其中一边现在有Ho,另一边有Hey,合并的结果将是Ho。

英文:

> will I get the same result independent of the timestamps?

Yes. A merge is performed by enacting simultaneously the "changes" on both sides since the point where the sides diverged. Both sides weigh 100% equally. It doesn't matter how they relate temporally or which side is being merged into which.

A common source of confusion, though, is failure to realize that lack of change on one side means no contribution. If the divergence point has Hey, and if one side now has Ho and the other side has Hey, the result of the merge will be Ho.

huangapple
  • 本文由 发表于 2023年8月10日 10:33:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76872314.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定