Newer Version Available

This content describes an older version of this product. View Latest

Resolve Conflicts Between Your Local Project and Org

As a best practice, if conflicts exist for components in your local project or in the org, resolve them before pushing or pulling. The two best ways to resolve conflicts are to manually incorporate conflicting changes or to overwrite one conflicting change with the other. It’s usually best to manually incorporate conflicting changes because overwriting one change can eliminate work.

Say you run force:source:status and see conflicting changes in your local project and in the org.

1=== Source Status
2STATE                     FULL NAME        TYPE           PROJECT PATH
3─────────────             ─────────        ─────────      ──────────────────────────────────────────────────────────────────
4Local  Add (Conflict)     WidgetClass      ApexClass      /WidgetClass.cls-meta.xml
5Local  Add (Conflict_     WidgetClass      ApexClass      /WidgetClass.cls
6Remote Changed (Conflict) Widget__c        CustomObject   force-app/main/default/objects/Widget__c/Widget__c.object-meta.xml

If you pull or push source, then the CLI reports these conflicts again and stops the operation from completing. To pull or push, resolve the conflicts, and then overwrite your local project or the org with the resolved file.

Overwrite Conflicting Changes

Overwrite conflicting changes by including the -f | --forceoverwrite parameter when pulling or pushing changes.

To overwrite your local project changes with source from the org, include the -f | --forceoverwrite parameter when pulling changes.

1sfdx force:source:pull -u DevSandbox -f

After pulling source, your local project has the same version of WidgetClass and Widget__c that existed on Salesforce. If you had changes in your local project, they are lost.

To overwrite the org with source from your local project, include the -f | --forceoverwrite parameter when pushing changes.

1sfdx force:source:push -u DevSandbox -f

After pushing source, your org has the same version of WidgetClass and Widget__c that exists on your local project. If there were changes in your org, unless those changes exist in another developer’s local project, they’re lost.