I'm working on a project on a given branch in VSCode, and want to compare my current file with the contents of the same file in a previous commit on a different branch. I think I can do this with the diff
command, but I want to do it visually in VSCode. Does anyone know how to do this?
2 Answers
You can use GitLens or Git History
In GitLens, you can run the editor command "Open changes with Branch or or Tag…". You can open the editor commands by pressing Control
/ Cmd
+ Shift
+ P
.
-
1
-
-
If this is what you are looking for, you can try revision navigation, specifically
gitlens.diffWithPrevious
as can be seen here Mar 8, 2022 at 9:52
I'm not really sure you can do that by default with VSCode. Or I don't know to do that too.
Currently, I use Git History extensions to do that.
I go to look on diff file, and click on Git History button on top and select the branch and commit where I want to diff with current file.