Q: Resharper throws errors when switching git branches I noticed that whenever I switch a branch in Git, Resharper will start throwing hundreds of errors in TypeScript. The only way to resolve this is to delete node_modules folder and run npm install again. This is a bit of a burden doing it every time as I am switching between branches and creating new ones whenever there is a task to be worked on.
Has anyone had a similar issue and how did you resolve it without reinstalling node modules? I am using ReSharper Ultimate 2016.3.2 (January 26, 2017 build).
UPDATE:
Let me update this question a bit. ReSharper will mark the errors where they do not exist. Even in this state the TypeScript code can be compiled without any problems. Pressing CTRL+SHIFT+ALT+8 disables ReSharper analysis for that TypeScript file and we are back to normal Visual Studio (as if ReSharper was not installed). The issue is not with NPM modules or Git settings. The problem is somewhere with how ReSharper tries to pickup the branch switching. Something confuses it.

A: As @Aleksey L. mentions, you need to add ignore rule to your .gitignore for the node_modules. 
But for this to work, you need to remove the modules from the repository by doing:
git rm --cached <file> for every module
you can even try git update-index --assume-unchanged <file> if you don't want to create an ignore rule,as suggested in this answer:
How to stop tracking and ignore changes to a file in Git?
Another possible workaround maybe to fidle a bit with Reshaper's settings:
Goto Options > Code Inspection > Settings > Elements to skip > Add node_modules
Options > Code Editing > Third-Party Code > Library code > Add node_modules
As suggested in this thread: Visual Studio Resharper with TypeScript and node_modules
After Question Update:
There is a suggestion on the last comment of this article: https://resharper-support.jetbrains.com/hc/en-us/community/posts/206014479-False-Positives-after-Git-Checkout-
Goto Options > General > Clear Caches and then restart
