Can .forceignore be used to not pull profiles that only exist in the scratch org?

I use this line in .forceignore for that:

force-app/main/default/profiles

The path should be relative to where your .forceignore lives


Based on Denis's answer, I just went ahead and did the pull with this in .forceignore:

**profiles

and got this result:

=== Pulled Source
STATE    FULL NAME                                         TYPE          PROJECT PATH
───────  ────────────────────────────────────────────────  ────────────  ─────────────────────────────────────────────────────────────────────────────────────────────────
Add      IntakeRelationship__c                             CustomObject  sfdx-source/main/default/objects/IntakeRelationship__c/IntakeRelationship__c.object-meta.xml
Add      IntakeRelationship__c.Account__c                  CustomField   sfdx-source/main/default/objects/IntakeRelationship__c/fields/Account__c.field-meta.xml
Add      IntakeRelationship__c.Contact__c                  CustomField   sfdx-source/main/default/objects/IntakeRelationship__c/fields/Contact__c.field-meta.xml
Add      IntakeRelationship__c.Intake__c                   CustomField   sfdx-source/main/default/objects/IntakeRelationship__c/fields/Intake__c.field-meta.xml
Add      IntakeRelationship__c.Type__c                     CustomField   sfdx-source/main/default/objects/IntakeRelationship__c/fields/Type__c.field-meta.xml
Changed  Intake__c                                         CustomObject  sfdx-source/wiz/main/objects/Intake__c/Intake__c.object-meta.xml
Add      IntakeRelationship__c-Intake Relationship Layout  Layout        sfdx-source/main/default/layouts/IntakeRelationship__c-Intake Relationship Layout.layout-meta.xml
Add      Security                                          Settings      sfdx-source/main/default/settings/Security.settings-meta.xml

which is what I wanted.

So it looks like despite this documentation How to Exclude Source When Syncing or Converting saying:

The .forceignore file excludes files when running force:source:push, force:source:pull, and force:source:status. For source:status, remote changes are checked against entries in the .forceignore file. Let’s say you added a class called HelloWorld.cls on the server and included an entry in .forceignore that matches the file name (such as HelloWorld.cls or HelloWorld.*). The source:status output omits the HelloWorld.cls.

the status and pull are not consistent in this case.


FYI, when pulling from the scratch org and not wanting to include profiles, I found that **profiles does not work, but **profile does.