Newer Version Available

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

Best Practices

Get the most out of source tracking by following these best practices.
Review metadata change history with a version control system like Git
With a version control system, you can version your changes, track change history, and review metadata changes before promoting to other environments, like a sandbox.
Get source tracking files back into sync
If source tracking gets confused and starts reporting inaccuracies, you can use the force:source:deploy|retrieve commands to get back into sync. Which command you use depends on which source you most trust: use force:source:deploy if you trust your local source files and force:source:retrieve if you trust what’s in your org. For either command, specify the --forceoverwrite parameter, which overwrites changed source in the org that conflicts with its local equivalent. Also specify --tracksource, which ensures that the source tracking files are correctly synchronized.

For example, let’s say your project has two package directories that contain all your source files, and you trust your local project over what’s in your org. Run this command, which deploys all local source to your org and synchronizes the source tracking files:

1sfdx force:source:deploy -p force-app,force-app2 --tracksource --forceoverwrite