Link the file names in a diffstat to where each file's diff begins - #6044
Open
stefanhaller wants to merge 1 commit into
Open
stefanhaller wants to merge 1 commit into
stefanhaller wants to merge 1 commit into
Conversation
stefanhaller
added this pull request to stack #6027
September 20, 2026 18:35
stefanhaller
force-pushed
the
jump-to-file-from-diffstat
branch
from
September 21, 2026 12:45
0a1e33f to
0fbab84
Compare
A diff opens with a diffstat naming every file in it, right above the
diff of each of them. Selecting a commit puts that list in front of you,
naming the same files the menu of the diff's files offers, and the menu
is still the only way to any of them.
Make each of those names a link that goes to where that file's diff
begins, as picking it from the menu does. The panel keeps the focus, so
a file of the commit being read is a click away and the selection stays
on the commit.
The names are found in the output as it is written to the pane, for next
to nothing. The diffstat is git's own text whichever renderer the diff
goes through — delta, diff-so-fancy and difftastic all pass it on
untouched — and it comes first, so the scan for it ends with it and
nothing below is looked at.
The link states the name as the diffstat does, and which file that names
is worked out on the click, against the files the diff turned out to
hold. That is the point at which a name the diffstat cut off behind
"..." or compacted to the "{old => new}" form of a rename can be
recognized at all.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
stefanhaller
force-pushed
the
jump-to-file-from-diffstat
branch
from
September 21, 2026 13:46
0fbab84 to
eaac12b
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
13th PR in the stack of PRs towards staging hunks directly from the main view. This one is stacked on #6043, and it concludes the work.
When selecting a commit, the main view shows its diff with the message first, then a diffstat listing all files changed by this commit, and then the actual diff body. The diffstat reads like a table of contents, and it has always bothered me that it isn't interactive; I always wished I could click on one of the file names to jump to that file in the diff.
Now you can. This PR turns the diffstat entries into clickable links that get underlined as you hover over them, like other hyperlinks in lazygit do. Clicking one scrolls the diff to the beginning of the clicked file, like with the
<ctrl-g>menu that was added in the previous PR. If you do this while the commits panel is focused, the focus stays there.