I'm in a file. I want to see it against main, or against yesterday's commit, or against the branch I'm rebasing. Not the whole repo in a web UI. Not a custom diff panel. The normal VS Code diff, the one that already feels right.
I tried to find existing solutions with Git related extensions like GitLens or Git History, but none of them was fitting my need.
Requirements
Get a diff of the current file against a ref
Keyboard shortcut to achieve the action
Let me choose the refs I'm comparing against
The extension
Annoyed by that I built Git Compare Ref Open (with the help of Composer 2.5).
Compare the active file with a Git ref, with current on the left or right
Compare the active file between two Git refs
Browse changed files between two refs in a searchable QuickPick
Open the selected file directly in VS Code's native Git diff tab
Where to get it
Open VSX, I skipped the VS Code Marketplace; too much friction for a small side project. Also on GitHub if you prefer a .vsix.
Enjoy!