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.
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
| Pattern | What 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.json | Shared workspace settingsFormatter and linter settings, build tasks and debug configurations help the team develop the same way. |
!.vscode/extensions.json!.vscode/*.code-snippets | Recommended 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-workspace | Multi-root workspacesRe-includes workspace files that group several folders, even if some template ignores them. |
*.vsix | Built extension packagesInstall packages created with vsce package when developing VS Code extensions. |
Practical notes
- Do not put personal preferences (font size, theme) in
settings.json; keep them in your user settings. Settings in the repository apply to the whole team. - If you put personal paths or tokens in
launch.json, replace them with variables such as${workspaceFolder}before committing. - If you want to hide
.vscode/entirely, put the single line.vscode/in your global gitignore instead of using this template. You give up sharing team settings, though.
Original template
VisualStudioCode.gitignore
# 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