Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code not honoring .gitignore in git tab

Tags:

git

gitignore

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?

like image 565
jasonleehodges Avatar asked May 03 '26 01:05

jasonleehodges


2 Answers

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.

like image 109
Saurav Sahu Avatar answered May 04 '26 21:05

Saurav Sahu


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

like image 21
Kartik Watwani Avatar answered May 04 '26 20:05

Kartik Watwani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!