Show .git and other default hidden folders and files in VS Code

Nick Gibbon
Pareture
2 min readSep 24, 2020

--

QUICK TIPS #2

Microsoft Visual Studio Code — like many consumer products — has default settings applied to help protect us from ourselves and reduce the chance of causing issues by accident.

One such setting is that certain files and directories are excluded from the VS Code file explorer view. And one specific example is the .git folder.

This folder is used to store important git related information and typically you absolutely want to leave it alone! However, I was recently looking at pre-commit hooks. These are implemented with scripts that live in the.git/hooks folder and so I wanted to be able to view and edit these files via my code editor.

How To

Using the VS Code toolbar go to ‘Code’ > ‘Preferences’ > ‘Settings’ and search for ‘exclude’ and you will find the default exclude list. Notice how this can be configured for the current user or the current workspace.

# Defaults
**/.git
**/.svn
**/.hg
**/CVS
**/.DS_Store

Hover over the entry you want to remove and you will be given an option to do so. Hit remove and it will be removed from the list. Notice how the list changes and you you can now see the .git dir in my repository example in the explorer on the left.

You can also follow the same logic to use this utilise this feature and add in custom exclusion of folders and files if you want!

Useful links

Microsoft Visual Studio Code Editor
https://code.visualstudio.com/

VS Code glob pattern help
https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options

Git Hooks
https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

--

--

Nick Gibbon
Pareture

Software reliability engineer & manager in cloud infrastructure, platforms & tools.