Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I ignore whole git repository in visual studio code?

It’s not about using .gitignore to ignore certain files, it’s about completely excluding that particular repository from file watcher of VScode.

It complains that there’s more than 5000 files are opened and then just hanged my laptop. This repository has insane amount of files, and it’s located in my home folder as my configs are stored in git, in .gitignore I’ve added all files to ignore, and when I need to stash the files I’m using git add -f <file>.

As you can see on the picture repository holms is always opened, and it's causing me issues, this is parent repo, which is in my home folder. How can I ignore it completely? if I close that repo, it appears again after like 3 minutes of working in a editor

enter image description here

like image 506
holms Avatar asked Mar 16 '18 16:03

holms


4 Answers

Had the same problem, try adding option:

"git.autoRepositoryDetection": false

and close repo from your parent (home) folder. It shouldn't appear again.

Update:

There's now an option to watch only repositories for opened files: "git.autoRepositoryDetection": "openEditors"

This way, if you open any file in a specific repository, vscode will only watch it.

like image 123
vkovic Avatar answered Oct 13 '22 04:10

vkovic


Another solution is to use the Ignored Repositories in settings, for example to ignore the repository in home directory you can add:

"git.ignoredRepositories": [
    "/home/holms"
],

Or from the settings editor (my username is obi)

enter image description here

like image 36
Obay Abd-Algader Avatar answered Oct 13 '22 04:10

Obay Abd-Algader


You could also select which repositories to hide manually:

enter image description here

like image 2
Tord Bjørnevaagen Brandsæter Avatar answered Oct 13 '22 04:10

Tord Bjørnevaagen Brandsæter


Open `source control repositories view enter image description here And select the main repository you want. It won't be reset after restarting.

like image 1
chen_767 Avatar answered Oct 13 '22 03:10

chen_767