Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore whitespace in Visual Studio Code git diff view

Is it possible to ignore white-space when viewing code differences of a file (generated by GIT) in Visual Studio Code? That will be really helpful in checking for actual code additions/deletions before committing.

like image 212
darKnight Avatar asked Nov 24 '16 06:11

darKnight


People also ask

How do I ignore a space in git?

We use the git diff --ignore-space-at-eol command to ignore whitespace changes at the end of our lines. Whitespaces at the beginning and in the middle of lines will remain in the git diff output. The git diff --b is the short form for the git diff --ignore-space-change that ignores whitespace at the line end.

How do I ignore whitespace changes in Github?

On github, you simply append the w=1 parameter to the URL for it to ignore whitespace.

How do I use git diff code in Visual Studio?

Viewing diffs# Our Git tooling supports viewing of diffs within VS Code. Tip: You can diff any two files by first right clicking on a file in the Explorer or OPEN EDITORS list and selecting Select for Compare and then right-click on the second file to compare with and select Compare with 'file_name_you_chose'.

How do I see the whitespace code in Visual Studio?

In Visual Studio for Windows, to display whitespace characters (tabs, spaces, etc) you simply press Ctrl + R, Ctrl + W.


1 Answers

Add on your settings.json:

"diffEditor.ignoreTrimWhitespace": true, 
like image 149
PaoloC Avatar answered Oct 25 '22 12:10

PaoloC