Skip to content

Conversation

LaksVister
Copy link

This feature adds a special button on the top right that allows you to navigate to a specific commit in the Git Graph from Git Diff Compare
Screenshot 2025-04-23 at 04 28 13

@LaksVister LaksVister requested a review from hansu as a code owner April 23, 2025 02:31
@hansu
Copy link
Owner

hansu commented Apr 23, 2025

Thanks for this PR. Generally a good idea, but it gives fuzzy results when viewing a diff of more than one commit.
In case you have multiple changes in a file done by several commits - then it jumps only to the most recent commit.
I can imagine that it could be extended in this way:

a) It jumps to the commit of the change where the cursor is located
b) It could be done with the context menu (clicking on the changed line).

What do you think about that?

@LaksVister
Copy link
Author

I followed option b) and made a few more fixes

Screenshot 2025-04-24 at 23 33 09

@hansu
Copy link
Owner

hansu commented Apr 24, 2025

The context menu feature does not work unfortunately:

gg2_Peek.2025-04-24.23-41.mp4

@LaksVister
Copy link
Author

Oh, I have implemented the transition only between two files, go to the commit from the left file or go to the commit from the right file, if you narrow the two diff files to one file, then the URI of this file will be one and will contain only one commit, so I don't know how to fix it.

But as I see, you want another one, to implement the transition taking into account the commit line, that is, Line History, it is possible, it is available in GitLens, but not with my capabilities, it requires too many changes in the code and logic of Git Graph.

GitLens Example
Screenshot 2025-04-25 at 01 39 00

@hansu
Copy link
Owner

hansu commented Apr 25, 2025

Hmm then I don't really know how your feature should be used. Can you provide an explanation (short video maybe)?

@LaksVister
Copy link
Author

LaksVister commented Apr 25, 2025

Yes, it's simple, the feature performs the basic function of finding the commit of the file being compared. Here is an example video of how it is done without the feature and with the feature, instead of search manually, I created a button. If you want, I can add a more specific description like "Go to Commit this File"

Screen.Recording.2025-04-25.at.10.35.47.mp4

What you suggest is already a separate feature, "Go to Commit this Line", and it needs a separate implementation function

@hansu
Copy link
Owner

hansu commented Apr 25, 2025

Ah ok now I understand the feature. It has a slightly rare use case. I could imagine using it in those two scenarios together with Git Lens:

gg5_Peek.2025-04-25.11-43.mp4

BUT when you are already using Git Lens, then you can also use the integrated functionality of Git Lens:

gg6_Peek.2025-04-25.11-48.mp4

@LaksVister
Copy link
Author

I did this just to separate from Git Lens, I rarely use it lately, I even plan to remove Git Lens or replace it, it still has a convenient commit search and comparison of the two branches and it doesn't work in Workspaces (it gives an error), nevermind.

As for the Go To Commit feature, it can be used with any File History, for example build-in VS Code Timeline even has local commit changes. Very useful.
Screenshot 2025-04-25 at 13 18 18

But I didn't have enough commit information to:

  1. See where this commit is in the graph
  2. See if there are changes to other files in the commit

That's why I use the Go To Commit button very often

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants