A team member started having issues when pushing code to new scratch orgs. After performing some investigation I figured that the .forceignore file was not respecting the ! prefix. The .forceignore file should follow the same rules and patterns as git uses with the .gitignore file.

Does anyone know how to fix that? It failed only in one Windows instance. No issues were detected when executing the same commands on Mac, Linux and on another Windows instance.

Workaround: Delete all forceignore content and push all code; or delete only the affected folder structure, then revert the changes back to its original state.

.forceignore example.


SFDX release note

CHANGE: As we warned last year, the force:source:* commands no longer support the old format of the .forceignore file. When parsing the .forceignore file, the commands now always use the same rules and patterns as git uses with the .gitignore file.

Git Pattern Format

An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined. Put a backslash ("") in front of the first "!" for patterns that begin with a literal "!", for example, "!important!.txt".

SFDX version + plugins

@oclif/plugin-autocomplete 0.3.0 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.3 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.10.1 (core)
@oclif/plugin-update 1.5.0 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
alias 1.1.22 (core)
apex 0.3.0 (core)
auth 1.7.5 (core)
config 1.2.46 (core)
custom-metadata 1.0.12 (core)
limits 1.2.3 (core)
org 1.9.0 (core)
salesforce-alm 53.4.1 (core)
schema 1.0.10 (core)
sfdx-cli 7.126.0 (core)
source 1.3.1 (core)
telemetry 1.2.8 (core)
templates 52.6.0 (core)
trust 1.0.10 (core)
user 1.5.2 (core)


You must log in to answer this question.

Browse other questions tagged .