You are here:
Exclude Metadata with the .forceignore File
Use the .forceignore file to exclude files or metadata types that you don’t want to commit to the source control or deploy to the target org in your release pipeline. This file makes sure that DX Inspector and DevOps Center don’t push or pull unnecessary files, such as IDE configuration files, local test data, or specific profiles, from the development environment.
Required Editions
| Available in: Lightning Experience in Professional (API access required), Enterprise, Performance, Unlimited, and Developer Editions |
| Not Available in: Government Cloud Plus. Contact your Salesforce account executive for more details. |
| Not available in: EU Operating Zone. EU Operating zone is a special paid offering that provides an enhanced level of data residency commitment. DevOps Center is supported in orgs in the EU that aren’t part of EU OZ, per standard product terms and conditions. |
During the commit process, DX Inspector reads the .forceignore file and excludes matching files and metadata from the source control repository and the work item. DevOps Center reads the file during promotion to identify and exclude the metadata types and files, preventing their deployment.
Considerations When Creating the .forceignore File
- If you used our template to create the repository, update the .forceignore file for your project requirements.
- If you’re adding the .forceignore file to an existing repository, place the file in the root folder of your Salesforce DX project directory.
- While you can create the .forceignorefile anytime, we recommend creating it when you build your pipeline so it’s in place from the start.
- Configure the file in the main branch associated with your release environment before activating your pipeline. This step copies the files to new branches.
- When you build your pipeline, if DevOps Center creates the repository and branches, each stage branch inherits the .forceignore file from the main branch. If you connect an existing repository or reuse existing branches, add a .forceignore file manually if it’s not available.
- Work item feature branches use the file version from the first pipeline stage branch.
- After you activate the pipeline, DevOps Center applies the file rules when pulling or promoting changes.
Sample .forceignore Syntax
The.forceignore file structure is similar to the .gitignore structure. Each line in the file contains a pattern corresponding to the files that you want to exclude, such as LWC configuration files, JSON files, or tests.
This sample file contains common files and folders that developers want to exclude at the
time of a commit or promotion. The syntax is different for the promote (deploy) and pull
(retrieve) operations. For example, to exclude all profiles when promoting changes, use
**/profiles/**. To exclude all profiles when pulling changes, use
*.profile. See How to Exclude Source When Syncing.
# List files or folders below to ignore them when deploying and retrieving changes
# Standard metadata
package.xml
# These metadata files are ignored when promoting (deploying)
**/appMenus/**
**/appSwitcher/**
**/fieldRestrictionRules/**
**/objectTranslations/**
**/profiles/**
**/profilePasswordPolicy/**
**/profileSessionSetting/**
**/settings/**
**/sharingRules/**
**/AuthProvider/**
# These metadata files are ignored when pulling (retrieving)
*.settings
*.appMenu
*.appSwitcher
*.rule
*.objectTranslation
*.profile
*.profilePasswordPolicy
*.profileSessionSetting
*.sharingRules
*.AuthProvider
# LWC configuration files
**/jsconfig.json
**/.eslintrc.json
# LWC Jest
**/__tests__/**Considerations When Updating the .forceignore File
- Update the .forceignore file in the main branch of your pipeline repository.
- If you have multiple DevOps Center pipelines, update the file in each pipeline repository.
- If the pipeline is already in use, changes don’t apply to existing branches automatically. To apply them everywhere, make the change in a work item and promote that work item. That way, DevOps Center applies the updated .forceignore file across the pipeline branches as you promote.

