Staging when ignoring whitespace, doesn't stage changed whitespace
See original GitHub issueIssue Type: Bug
- Indent several lines of code, and save. These should appear as changes in Git.
- Click on “Open changes”.
- Ensure whitespace changes are hidden (which is the default).
- Select the indented lines, and stage them with “Stage selected ranges”.
- Nothing is staged. Even though whitespace is hidden, shouldn’t changes like indentation be staged, if they’re within the selected range? Otherwise I end up with lines like
if (true)
staged, since it’s a text change, but the block contained within its braces as not staged, since it’s just an indentation change.
VS Code version: Code 1.29.1 (bc24f98b5f70467bc689abf41cc5550ca637088e, 2018-11-15T19:06:21.742Z) OS version: Darwin x64 18.0.0
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:6 (2 by maintainers)
Top Results From Across the Web
git - Add only non-whitespace changes - Stack Overflow
Basically we create a diff that doesn't include the space changes, ... This leaves the whitespace changes unstaged and the rest staged.
Read more >git-show Documentation - Git
Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters...
Read more >Hide whitespace changes doesn't hide all whitespace changes
Look at the diff with Show Whitespace changes both on and off, observe that whitespace changes with leading whitespace are always displayed.
Read more >How To Ignore Whitespace With Git Diff? - Tim Mousk
The git diff command helps developers see the changes between two data sources (commits, branches, etc.). However, sometimes this command ...
Read more >How to avoid committing whitespaces using Visual Studio and ...
If it shows that the entire file has changed, this is most definitely due to a line endings issue. That is, your text...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To anyone arriving from Google, the current workaround is
"diffEditor.ignoreTrimWhitespace": false
.Yeah, if I show whitespace changes, then it works. But I’m asking, why does it work that way? Meaning, if I have whitespace changes hidden, and I stage a range, then the textual changes are staged, but the whitespace changes are not staged. So I end up with a commit that has changes committed without any indentation, so I have to then stage and commit the indentation separately.
Having whitespace changes hidden definitely makes it easier to identify changes, but having to remember to turn it on before any staging every time, is a bit tedious.