Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code Git won't discard files

I have about 5000 files that I am unable to discard and VSCode keeps warning me that there are too many files. I'm not sure when I started tracking these files, but if I click on discard and then confirm the discard, nothing happens. Any ideas on how I can solve this?

like image 898
Nitika Nadgar Avatar asked Jun 22 '26 11:06

Nitika Nadgar


2 Answers

VSCode recently renamed the "Clean" option onto "Discard".
But it is about unstaging current changes, not deleting files.

If you have too many files (that should not be part of the repo, for example because they are generated), simply delete them, then record your deletion (add and commit).
Then you will be able to push.

Additionally, consider adding them (or their parent folder) to a .gitignore file.

like image 110
VonC Avatar answered Jun 24 '26 03:06

VonC


this is from a while ago but for anyone else having this problem. The way I solved it was because I had clicked my home directory when using source control.

Try closing and reopening vs code and once the "open a folder" option comes up pick the specific project folder and the 5000 files should be reduced to the files you want

like image 24
LandscapeGolfer Avatar answered Jun 24 '26 03:06

LandscapeGolfer



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!