Search code examples
gitgitignore

Visual Studio Code not honoring .gitignore in git tab


I've appropriately configured a .gitignore file and put it in the base directory of my project, but when I go to the git tab of Visual Studio Code it does not ignore the folder that I'm trying to ignore and therefore is suggesting that there are changes for 4000+ files that I don't care about (the folder that I'm trying to ignore is a virtual environment for python).

Has anyone else successfully gotten the git tab to ignore changes using the .gitignore file?


Solution

  • Gitignore doesn't affect the files which are already tracked.

    To stop tracking a file that is currently tracked, use git rm --cached <dir>. It removes the file from the staging area entirely, but doesn't delete the directory from disk; instead leaves the directory as it is.