The documentation says:

Sometimes, you make a change directly in a scratch org but you don’t want to pull that change into your local DX project. To exclude remote metadata changes, use the format <api name>.<metadata type> in .forceignore.

Also I've seen people replace statement like this **PasswordPolicy** with this .PasswordPolicy. But when I add .CustomMetadata it does not work and sfdx pull operations does pull new/changed metadata.

My company adds custom metadata to the package as preconfigured project settings. But when you develop at scratch org you add/change project settings and you don't want to pull them from scratch org.

Obvious solution is to exclude customMetadata directory, but you have to comment/uncomment it when developing and when creating a new package. Is there a better way of handling this?

1 Answer 1


This might be a bug in the Source Tracking and you should raise a support ticket to make sure this is fixed for Custom Metadata records for the pull command for the exclude remote metadata changes case. use

For a workaround, one simple technique is to create a different folder than your default force-app

Like You can call it unpackaged and have the records there and do not make it as default path as a part of the packageDirectories definition in your sfdx-project.json. Also do not specify this path in package generation.

Check Multiple Package Directories to understand further.

  • 1
    Seems like moving metadata to another directory from "default" does the trick. Now .forceignore does block server metadata, but when I first push to the org my local metadata is pushed, because I blocked only default/customMetadata folder.
    – Mr Smith
    Mar 23, 2021 at 20:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .