There does not appear to be a way to do this. I have a feeling its due more to how git add
and/or git diff
works than it is a Visual Studio problem. Visual Studio Code exhibits the same behavior as well.
I think it is because when you stage an item, it is no longer within your working directory, but rather now in the staging area (or index). I came across this answer which lead me to the book Pro Git. In this book, for git diff
(see the Git Basics chapter), it states the following:
It’s important to note that git diff by itself doesn’t show all changes made since your last commit — only changes that are still unstaged. If you’ve staged all of your changes, git diff will give you no output.
This goes back to when I said it might be due to have git add
and git diff
works. Visual Studio is essentially doing a git diff
to determine the modified lines in your file. And since the lines of code in question are now staged (git add
'ed), git diff
can no longer display the changes.