2

wadewegner has an example .gitignore file with the below content

.DS_Store
.sfdx
.project
.salesforce
.settings
node_modules
.idea

As part of his sfdx-simple app on GitHub.

Should this file include an entry for VSCode when using VSCode?

.vscode
3

I typically do include .vscode in my .gitignore. That directory shouldn't be under version control.

You can also create a global .gitignore that applies across all projects, although that doesn't provide benefit for other users who clone your repo.

  • do you also usually include .db in the gitignore? – BlondeSwan Mar 7 at 15:48
  • I'm not sure off the top of my head what .db is. I .gitignore most cache, settings, and support files that aren't part of the project's source as such. – David Reed Mar 7 at 15:53
  • I attempted to run a test (vscode couldn't run it) while I was just playing around, and it created an apex.db file in .sfdx/tools. – BlondeSwan Mar 7 at 15:57
  • 1
    Oh, yeah, you'd probably want to exclude the entire .sfdx directory. – David Reed Mar 7 at 15:58
2

In general, you should not commit .sfdx or .vscode, as these files store configurations specific to the local computer's workspace. Committing these files may cause issues when migrating to a new computer or sharing between other developers. If you use another IDE, like Force.com IDE, also make sure you do not reference things like "Referenced Packages" or any other metadata cache directories.

1

It depends whether you want to share the settings inside the .vscode folder.

On our team, we don't put .vscode into the .gitignore file because we want to share our team's recommended settings, launch configurations, tasks and extensions between developers. If you have machine specific settings then that won't work so well.

If you only want to share some settings between developers then you can pick and choose which settings files to put into .gitignore. Recommended extensions are in .vscode/extensions.json, for example.

Whether you want to share these settings is somewhat dependent on what sort of repository it is. If it's an open source repository where everyone might want different configurations for their own workflows then maybe it's best not to check them into git. For teams where it's nice to have your configuration shared for a consistent workflow then it often works well to check them in.

1

The .vscode directory contains a lot of local workspace settings and many you may not wish to share. It is also specific to VS Code and won't help anyone using a different editor.

Some other settings like formatting configuration you may wish to share for consistency. One potential compromise is to use a .editorconfig file and the editorconfig VS Code extension to share some of the editor specific settings without some of the other vscode/workspace specific settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.