Giuseppe
Giuseppe

Reputation: 408

Vscode, git diff view: how show only changes

I'm new to VSCode and can't find online if is possible to have my favorite diff view mode: I want to see only the lines changed - and the closer ones - not the entire file with the highlighting of the changes.

E.g.: in the image I've deleted\added 2 lines: one at 8 and one at 90. I'd like to see only those changes, not the entire file.

Thanks

enter image description here

Upvotes: 20

Views: 15963

Answers (3)

Philippe
Philippe

Reputation: 31107

edit: there is now a button, in the toolbar at the top, to collapse/uncollapse unchanged parts of the file (even if you are still in a real text editor):

collapse unchanged parts of file

previous (no more accurate) answer:

I think that's not possible because what is provided here is a real text editor where you can edit the content of the file.

With the toolbar at the top...

vscode diff toolbar

... you could still:

  • go to previous/next change (Alt+Shift+f5/Alt+f5)
  • toggle to display inline diff

Upvotes: 12

Anand
Anand

Reputation: 341

Add these properties in the settings.json file and restart VS Code.

"diffEditor.experimental.useVersion2": true,
"diffEditor.experimental.collapseUnchangedRegions": true,

enter image description here

Original GitHub Issue

Upvotes: 7

Paweł
Paweł

Reputation: 21

Such feature request is tracked here: https://github.com/microsoft/vscode/issues/3562. You can let developers know you'd like to see it implemented with a thumbs-up reaction to the first post.

Upvotes: 2

Related Questions