Git 2.36.0 released
But this [merge conflict] output can be understandably difficult to interpret. In Git 2.36, --remerge-diff takes a different approach. Instead of showing you the diffs between the merge resolution and each parent simultaneously, --remerge-diff shows you the diff between the file with merge conflicts, and the resolution.
Posted Apr 19, 2022 9:56 UTC (Tue)
by osma (subscriber, #6912)
[Link] (3 responses)
Posted Apr 19, 2022 11:27 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link]
The new one is fine because I see 3-way diffs all the time. I can see that line X came from side A and line Y came from side B very easily. If there's a line which is different from any change, it shows up as a modified line instead of a series of line removals.
Posted Apr 19, 2022 20:05 UTC (Tue)
by iabervon (subscriber, #722)
[Link]
I think the new one can only be understood correctly or not at all, and is much more clearly saying "this is how the conflict was resolved"; on the other hand, conflict resolution is a difficult skill, and this relies on it in order to make sense of the output.
I think there might be a way to present it as a diff from the common answer to the merge result, marked with attribution as to the side it came through (or marked that it was new in the merge commit).
Posted Apr 19, 2022 22:57 UTC (Tue)
by newren (subscriber, #5160)
[Link]
Also, looking at remerge-diff output for merges done by others tend to be harder to read than for merges you performed.
It can be understood this way: Basically, if you were to redo the merge of the two branches using 'git merge' now, and you run into conflicts, then git merge stop and point out that you need to resolve some issues. Resolving the conflicts will involve removing conflict markers, choosing which lines to keep, and possibly modifying some of those lines (and maybe even making other modification outside of the "conflict region"). The remerge-diff output is simply the changes from where 'git merge' would have stopped and told you to resolve things, and what got recorded in the commit. If it was a clean merge (and you didn't amend the merge commit), then the remerge-diff output will be empty.
Posted Apr 20, 2022 21:49 UTC (Wed)
by marcH (subscriber, #57642)
[Link] (6 responses)
The generic problem is: how to compare diffs? While the final goal is different, it's a very similar problem to comparing v1 and v2 of a patch series (a.ka. "history of the history", git range-diff etc.) In both cases you have a common base and two "branches" that diverged from each other.
I've seen religious arguments between fans of the side-by-side (X axis) diff versus inline diff (Y axis) but for comparing diffs you obviously want to leverage BOTH dimensions instead of experimenting with various, all unreadable ways to collapse the two dimensions on a single axis using two columns and what not.
In other words: "diff --side-by-side v1.patch v2.patch" or "diff --side-by-side branch1.patch branch2.patch" and problem solved.
This is similar to the religious and pointless "command-line versus GUI?" debates; the answer is here "both of course". In fact I can easily imagine a connection between these two debates - graphical diff tools have been preferring side by side diffs since forever.
Posted Apr 21, 2022 17:04 UTC (Thu)
by newren (subscriber, #5160)
[Link] (5 responses)
Posted Apr 21, 2022 17:28 UTC (Thu)
by mathstuf (subscriber, #69389)
[Link] (4 responses)
Still waiting on forges to adopt this command's output for rebased MRs…
Posted Apr 21, 2022 17:59 UTC (Thu)
by marcH (subscriber, #57642)
[Link] (3 responses)
More background in the Gitlab feature request https://gitlab.com/gitlab-org/gitlab/-/issues/24096
Posted Apr 21, 2022 18:14 UTC (Thu)
by newren (subscriber, #5160)
[Link] (1 responses)
Also, the link you give for Gerrit seems to be for a single change. While you can do a range-diff for a single patch of a series, it's not quite the same thing. I did like the comparison of the current patch against older patchsets and used that in Gerrit, but I still I really would have liked something like range-diff in Gerrit back when I was still using it up to about 6 months ago. To my knowledge, it still doesn't exist in Gerrit.
Out of curiosity, was there something in the Git 2.36 release announcements that triggered this discussion about this feature from Git 2.19, or is this just an interesting tangent?
Posted Apr 21, 2022 19:55 UTC (Thu)
by mathstuf (subscriber, #69389)
[Link]
The GP was comparing the diff rendering changes to diffs-of-diffs.
Posted Apr 21, 2022 18:16 UTC (Thu)
by mathstuf (subscriber, #69389)
[Link]
> More background in the Gitlab feature request https://gitlab.com/gitlab-org/gitlab/-/issues/24096
Yeah, that's a visited link for me :) . One of my issues is even closed as a duplicate of this one.
I find the Git 2.36.0 released
--remerge-diff
example extremely confusing, but maybe that's just me. The old-style output is very clear, but I can't figure out the new one.
Git 2.36.0 released
Git 2.36.0 released
Git 2.36.0 released
diff --side-by-side v1.patch v2.patch
diff --side-by-side v1.patch v2.patch
diff --side-by-side v1.patch v2.patch
diff --side-by-side v1.patch v2.patch
I think that was long before git itself had it.
diff --side-by-side v1.patch v2.patch
diff --side-by-side v1.patch v2.patch
diff --side-by-side v1.patch v2.patch