'How to add folder and subfolder to gitignore?

I have added the gitignore file but the /node_modules is still showing untracked.

enter image description here

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source