Visual Studio Code: .git folder/file hidden

GitVisual Studio-Code

Git Problem Overview


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?

Git Solutions


Solution 1 - Git

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 - Git

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 - Git

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 - Git

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 - Git

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.

Solution 6 - Git

You should also be aware of the search.useIgnoreFiles setting, which will ignore files and folders that are ignored using .gitignore and .ignore files.

Solution 7 - Git

Go to vscode and find the setting.json file. For

Windows: ctr+p and find >setting.json file or mac: command+p and find >setting.json file in the search bar

add

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

This will work

Solution 8 - Git

You can access this setting in the settings option.

Then we need to copy this particular settings section to the right side and make the changes.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBumsik KimView Question on Stackoverflow
Solution 1 - GitNishant SinghView Answer on Stackoverflow
Solution 2 - GitVikash Kumar ChoudharyView Answer on Stackoverflow
Solution 3 - GitPatricia GreenView Answer on Stackoverflow
Solution 4 - GitSblipDevView Answer on Stackoverflow
Solution 5 - GitIsaac PakView Answer on Stackoverflow
Solution 6 - GitArikView Answer on Stackoverflow
Solution 7 - GitVikram KumarView Answer on Stackoverflow
Solution 8 - GitIshan PatelView Answer on Stackoverflow