Sometimes we have a local branch with accmulated huge features to be merged into origin main. At this time, we need to have a comprehensive diff view to obtain a general understanding of these changes. One way to do this is creating a draft PR in GitHub, and compare source and target branches using its two-column view. However, this brings some inconvinience like, we cannot have Intellisense jump and highlight there, and we cannot easily obtain the edit history of a certain file.
So this post recommands a way to show how to trigger the Git diff view in VSCode / Cursor with syntax highlight and linter jump, with the plugin GitLens.
After installing the extension, in VSCode, press ⌘ + ⇧ + P, toggle on the command menu, then type GitLens: Compare Working Tree with... or GitLens: Compare HEAD with..., which compares the unstaged or staged changes with a specificed branch or commit, locally or remotely.
In the split diff view, you can also jump or view the code changes with rich LSP support.