'How to compare current working tree file with last previous version (git or local history)?
(I think) I need a way to compare my current file with the modifications from previous commit (in this case, it might also be a the last saved version in local history). When the file of interest is open I left click on the last commit in the timeline:
I thought that gives me the current file compared to the previous commit and I thought I can make changes to the current file in the diff view to get some changes back from the previous commit or so.
That is not the case. The diff editor that opens shows the diff of selected commit in the timeline with the previous one. Both editor panes are read-only:
(Maybe that is okay to show it this way, but if it is, how to compare the current file to the most recent commit?)
I know there are many extensions. I don't want to use a huge extension like gitlens to get this solved. I think vscode already has enough functionality built in that would make it possible to compare current version to last version.
Left clicking the last saved version of the local history shows the most recent versions in a diff view on both panes. I thought it shows the current working tree file with the changes made in the last save (also: local file editable). It does not show any changes:
Solution 1:[1]
One way for showing the changes between git and current workspace file it seems there are editor decorations that can be clicked and then show the diff as a kind of peek preview:
another way is to use the Show changes
button in a file with modifications in comparison to git:
This function opens the last changes in comparison to the latest commit and the local file shown is editable.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | AD7six |