Track Changes Between Your Project and Org

Use source tracking to track the changes between your local project and a scratch org or sandbox when you create, update, or delete source code.

Source tracking has no direct effect on the org; it affects only your local environment. Specifically, Salesforce CLI checks a local configuration file to determine whether you’ve enabled source tracking for a particular org. If you have, then source tracking operations are executed when you work with the org, such as using the project deploy start command.

The project deploy|retrieve start commands without flags deploy or retrieve all changed source between your local project and the target org. For more granular control, use flags to specify specific metadata components, package directories, or manifest files to deploy or retrieve. This example retrieves the MyFabClass Apex class:

sf project retrieve start --metadata ApexClass:MyFabClass

In addition to listing the changes you make, source tracking makes it possible to:

  • Automatically track changes to metadata components, saving you from tracking them manually.
  • See changes deployed to a sandbox by other developers.
  • Deploy or retrieve changed source.
  • Identify and resolve conflicts between your local project and scratch org or sandbox before deploying or retrieving source.

To see which metadata components support source tracking, check the Source Tracking column of the Metadata Coverage Report.