.gitignore for Salesforce DX

20 ignore rules for Salesforce DX, ready to copy into your repository.

Salesforce development projects (SFDX, Lightning Web Components)

The complete .gitignore for Salesforce DX

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-09-17 18:11:14 UTC
# Technologies: Salesforce DX

### Salesforce DX ###
.sf/
# Salesforce DX local cache
.sfdx/
.localdevserver/
deploy-options.json
.localdev
logs
# LWC VS Code autocomplete config
**/lwc/jsconfig.json
coverage/
# Log file
*.log
# ESLint cache
.eslintcache
# Windows thumbnail cache
Thumbs.db
# Windows enhanced thumbnail cache
ehthumbs.db
# npm debug logs
npm-debug.log*
# Windows folder configuration
[Dd]esktop.ini
# Yarn debug logs
yarn-debug.log*
# Windows recycle bin
$RECYCLE.BIN/
# Yarn error logs
yarn-error.log*
sca-results.csv
sfca_results.json
# Environment variables
.env

What these Salesforce DX rules actually ignore

Every pattern below, and why it belongs in your .gitignore.

Salesforce cache

Pattern What it ignores
.sf/ Salesforce cache
.sfdx/ Salesforce DX local cache
.localdevserver/ Salesforce cache
deploy-options.json Salesforce cache
.localdev Salesforce cache

Logs

Pattern What it ignores
logs Logs
*.log Log file
npm-debug.log* npm debug logs
yarn-debug.log* Yarn debug logs
yarn-error.log* Yarn error logs

LWC VSCode autocomplete

Pattern What it ignores
**/lwc/jsconfig.json LWC VS Code autocomplete config

LWC Jest coverage reports

Pattern What it ignores
coverage/ LWC Jest coverage reports

Eslint cache

Pattern What it ignores
.eslintcache ESLint cache

Windows system files

Pattern What it ignores
Thumbs.db Windows thumbnail cache
ehthumbs.db Windows enhanced thumbnail cache
[Dd]esktop.ini Windows folder configuration
$RECYCLE.BIN/ Windows recycle bin

Salesforce Analyzer results

Pattern What it ignores
sca-results.csv Salesforce Analyzer results
sfca_results.json Salesforce Analyzer results

Local environment variables

Pattern What it ignores
.env Environment variables

How to use this .gitignore for Salesforce DX

  1. Copy the Salesforce DX rules above, or download the file directly.
  2. Create a file named .gitignore at the root of your Git repository and paste the rules into it.
  3. If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
  4. Commit the .gitignore so everyone on the team shares the same rules.

Other CRM .gitignore templates

See every CRM template