Reputation: 311
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?
Upvotes: 2
Views: 3399
Reputation: 657
What worked for me was I right clicked any one of the file(while the git tab is selected) under changes
menu which I didn't wanted and was also in one of the directories mentioned in the .gitignore
file. After right clicking I selected Add file to .gitignore
and boom all the unwanted 5k files went from git tab. And I was happy :)
Upvotes: 3
Reputation: 13974
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.
Upvotes: 6