martiendt
martiendt

Reputation: 2216

How can I show .gitignored / .ignored files in visual studio code?

My tree view hides all of the ignored files that are listed in .gitignore. I cannot find anything in settings.json to show ignored files in my project. How do I show files ignored because of .gitignore?

Upvotes: 38

Views: 35806

Answers (8)

iconoclast
iconoclast

Reputation: 22680

The defaults of VS Code puzzle me, but fortunately there is a way to override them. I spent hours searching for a way to expose these files in the Explorer view, and only found it through experimenting based on what I already had for the search:

"search.useIgnoreFiles": false,
"files.useIgnoreFiles": false,

Update: see comments below for updates

Upvotes: 29

Steve
Steve

Reputation: 41

First click on the Settings (geartooth) at the bottom of the left margin.

Then search for gitignore.

Un-check the "Explorer: Exclude Git Ignore" box

Upvotes: 4

zumalifeguard
zumalifeguard

Reputation: 9016

For me, the only way I could get the Explorer to show ignored files is using this setting:

      "explorer.excludeGitIgnore": false

I have file .env ignored, but would like to see it in the Explorer. The above setting addressed it.

Upvotes: 14

Shlomi Lachmish
Shlomi Lachmish

Reputation: 581

On the root of your project update the following file: .vscode/settings.json

{
  "files.exclude": {
    "**/.gitignore": false,
    "**/.git": true,
    "**/.vscode": false
  }
}

Upvotes: 1

Li Junjie
Li Junjie

Reputation: 101

go to Preferences > Settings, uncheck the option search:Use Ignore Files, then it works

Upvotes: 10

ronbravo
ronbravo

Reputation: 9

One interesting work around I found is that in VsCode's file browser, if you right click and create the file or directory you need (ex: right click -> create file -> .gitignore), it will show up. Not the best solution especially if things are nested but gives a quick and dirty way to do it. Also added this answer to the Github issue.

Upvotes: 0

drussell
drussell

Reputation: 649

this is possible - go to Preferences > Settings, and edit the User Settings file to comment out excluded files in the "files.exclude" section - like node_modules etc. Here are my settings for example:

"files.exclude": {
  "**/.git": true, // this is a default value
  "**/.DS_Store": true, // this is a default value
  // "**/node_modules": true,
  "**/jspm_packages": true,
  "**/coverage": true,
  "**/public": true,
  "**/.cache": true,
  "**/.bundles": true,
  "**/es": true,
  // "**/dist": true,
  // "**/lib": true,
  "**/umd": true
},

Upvotes: 2

Llewey
Llewey

Reputation: 9242

This is not currently possible in VS Code but there is discussion in this github issue about making it possible.

I suggest that you give a thumbs up reaction to the issue (click on the thumbs up in the bottom left of the initial post) to voice your support and follow the issue so you can find out if something changes.

Upvotes: 7

Related Questions