Home > Mobile >  See changes in a merge commit that do not appear in any parent
See changes in a merge commit that do not appear in any parent

Time:12-11

A merge commit can potentially introduce changes that did not appear in any parent commit. For example, when making changes to resolve conflicts or in the case of evil merges. Is there a git command to only see such changes in a merge commit, instead of the default combined-diff format?

CodePudding user response:

You audit merge resolutions by rerunning the merge and comparing the automerge result with the recorded result. If the automerge produced conflicts you probably want to look at the resolution even if it's just taking one or the other parents' versions, because, somebody had to choose which and that's a chance for human error right there.

To do this fast, do minimum-checkout merges in a scratch clone.

To make this easier, Git would have to slow down and bulk up every merge, and every repository, and Git's after not doing that.

CodePudding user response:

Mechanical checking of a conflict resolution isn't a coherent concept. After all, the reason this is a "conflict" is exactly that a machine can't do the merge. That's all a merge "conflict" is: it's a merge that needs human intervention.

As for your proposed algorithm, it's incorrect: a "conflict" might quite legitimately be resolved by making changes that don't match the parent or either of the two branch diffs. For example:

base: Hello there
branch1: Hello world
branch2: Goodbye there

That's a "conflict". Resolution:

Goodbye world

That is arguably perfectly right, as it carries out exactly the intentions of both branches; but it doesn't match any of the precedents.

  • Related