github/gitignore · Global/VisualStudioCode.gitignore

VS Code .gitignore Template Explained

Why VisualStudioCode.gitignore excludes the folder contents with .vscode/* and restores the settings, tasks, launch and extensions files with negation patterns, and what to share.

Open in generator Open with Node, Python, macOS, Windows

VisualStudioCode.gitignore is a textbook example of negation patterns. It excludes all the contents of the .vscode/ folder, then re-includes with ! only the settings files worth sharing with the team.

The key point is that it is written as .vscode/*, not .vscode/. If the directory itself is excluded, git does not look inside it, so the ! rules that follow have no effect.

Rules explained

PatternWhat it ignores and why
.vscode/*Exclude folder contentsFirst excludes every file inside .vscode, including caches and personal settings created by extensions. The folder itself is not excluded, so files inside it can be restored.
!.vscode/settings.json!.vscode/tasks.json!.vscode/launch.jsonShared workspace settingsFormatter and linter settings, build tasks and debug configurations help the team develop the same way.
!.vscode/extensions.json!.vscode/*.code-snippetsRecommended extensions and snippetsextensions.json is the list of extensions suggested for installation when the project is opened, and .code-snippets files are project-specific code snippets.
!*.code-workspaceMulti-root workspacesRe-includes workspace files that group several folders, even if some template ignores them.
*.vsixBuilt extension packagesInstall packages created with vsce package when developing VS Code extensions.

Practical notes

Original template

VisualStudioCode.gitignore8 rules
# Visual Studio Code.vscode/*!.vscode/settings.json!.vscode/tasks.json!.vscode/launch.json!.vscode/extensions.json!.vscode/*.code-snippets!*.code-workspace# Built Visual Studio Code Extensions*.vsix

Templates from github/gitignore/Global/VisualStudioCode.gitignore @356fd7b (2026-09-11) · CC0-1.0

Often used together

More template explanations