If you search for good .gitignore
rules for Visual Studio Code, you often come across these.
##
## Visual Studio Code
##
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
I tried using them for a while, but they just lead to problems. It is the equivalent of committing the .user
files in other .NET projects. The file launch.json
, for example, contains my own command-line arguments, environment variables, etc. Why would I want those committed? Why would I want changes from other developers overriding mine all the time? Who decided this was a good idea?
It's particularly annoying because dotnet new gitignore
imports these questionable rules. I just block the entire folder now.
.vscode/
If I ever clone my repo from scratch, VS Code offers to whip up a new set of files for me anyway. Are there other languages/environments where committing these files is extremely beneficial?
Top comments (2)
The aim of adding these is so that when someone new checks your code out it's ready to go. Any required tools or extensions are installed and default arguments are set.
The usual use of the launch.json is to be able to launch in a number of different modes to control things like whether to run with debugging or certain other optimisations enabled, or simply to run tests.
I wouldn't use this mechanism to store any value that could be considered a secret, like username, password or database connection details (there are other ways of doing that).
Hey thanks, I was trying to gitignore vscode Peacock settings and .vscode/* did it for me.