Visual Studio Code: .git folder/file hidden

I am trying Visual Studio Code at this moment. Everything about Visual Studio Code look really cool to me except one thing: .git folder/file is hidden in Visual Studio Code.

I often change Git setting by modifying the .git configuration file. It is really annoying for me not able to see .git files.

Is there a way to reveal .git files in Visual Studio Code?


Solution 1:

By default Visual Studio Code excludes files in a folder using the following settings:

"files.exclude": {
    "**/.git": true,
    "**/.svn": true,
    "**/.hg": true,
    "**/.DS_Store": true
}

You can change your user settings or workspace settings to show the .git folder by adding these lines:

"files.exclude": {
     "**/.git": false
}

Solution 2:

The below steps can be followed to override the existing user setting:

  1. Menu CodePreferenceSetting
  2. Search for files.exclude
  3. Mouse over files.exclude property, click on the edit icon and then opt for the copy to settings.
  4. The above steps will add all the properties, but keep only those which need to be overridden. For this case: it should be, "files.exclude": { "**/.git": false }
  5. Close the user setting. the .git folder will automatically appear in the respective repository.

Solution 3:

The settings for Visual Studio Code can be found:

  • On a Windows or Linux computer, click menu FilePreferencesSettings
  • On a Mac, click menu CodePreferencesSettings

There are both users settings (for everyone) and workspace settings for individual projects.

More instructions can be found at: User and Workspace Settings

Solution 4:

If you want to configure vscode to show .git directory, you need to settings in vscode by (cmd + ,) or (ctrl + ,). If you do it you will see a search bar, type "Files: Exclude" , when you see the top result just hover over the .git row and you will see a close icon or a delete icon. Click on that. After you click on that done! Now you will be able to see the .git directory in the vscode explorer.

Solution 5:

It's probably best to leave this hidden

If you are using the sidebar to navigate and edit files, it would leave an opportunity to accidentally drop a file or folder in it, or accidentally move it to a different location. A better solution would be to open a terminal session in Visual Studio Code and then do code .git. That will open the folder in another Visual Studio Code instance and from there you can edit it.