lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

For "divergence from upstream" view, indicate which commits have changed

Open stefanhaller opened this issue 2 years ago • 1 comments

When we have the new divergence from upstream view, it will be useful to somehow indicate visually which corresponding commits of the left/right sections have identical patches.

Use case: you see that your branch has diverged, and you don't remember whether that's because you rebased it, or because your co-worker has. You open the divergence view, and see that the co-worker has rebased onto a newer master; this is easy to tell from the blue/green coloring of the upstream commits. The rest of the commits have corresponding commit subjects, but from this view you can't tell whether some of those commits have additional changes that either you or your co-worker have sneaked in.

I haven't thought very much about how to implement this, but git has this concept called patch-id which can be used to see if two diffs at different locations in the history graph are "the same". It won't work in cases where conflicts occurred during the rebase, but apart from that it should be a good indication of patch equivalence.

Unfortunately the --pretty=format option of git log doesn't seem to support outputting patch ids directly, so we'll either have to generate them ourselves from the diffs of the individual commits, or somehow make use of the git cherry command to generate the information.

I'm also not sure what's the best way to visually indicate the information; I'd think about something along the lines of "greying out" those commits that have a corresponding patch on the other side.

stefanhaller avatar Aug 13 '23 12:08 stefanhaller

I've come across the need for this a couple times in the last week: I agree this would be great: greying out commits whose patches are identical

jesseduffield avatar Jan 28 '24 01:01 jesseduffield