jesseduffield / jesseduffield/lazygit

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

Open
#2,931 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

When we have the new [divergence from upstream view](https://github.com/jesseduffield/lazygit/pull/2871), 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](https://git-scm.com/docs/git-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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.