简体   繁体   中英

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?

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.

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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM