source Commands

Use the source commands to push and pull source to and from your scratch orgs, to deploy and retrieve source to and from non-source-tracked orgs, to see synchronization changes between your project and scratch orgs, and to convert your source to the metadata format for Metadata API deployments.

force:source:convert

Converts source-formatted files into metadata that you can deploy using Metadata API.

Help for force:source:convert

To convert source-formatted files into the metadata format, so that you can deploy them using Metadata API, run "sfdx force:source:convert". Then deploy the metadata using "sfdx force:mdapi:deploy".

To convert Metadata API–formatted files into the source format, run "sfdx force:mdapi:convert".

To specify a package name that includes spaces, enclose the name in single quotes.

Examples:

1$ sfdx force:source:convert -r path/to/source
1$ sfdx force:source:convert -r path/to/source -d path/to/outputdir -n 'My Package'

Command Syntax

sfdx force:source:convert
[--json]
[--loglevel LOGLEVEL]
[-r ROOTDIR]
[-d OUTPUTDIR]
[-n PACKAGENAME]
[-x MANIFEST]
[-p SOURCEPATH]
[-m METADATA]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-r | --rootdir ROOTDIR
Optional

A directory other than the default package directory that contains the source-formatted files to convert.

Type: directory
-d | --outputdir OUTPUTDIR
Optional

The output directory to store the Metadata API–formatted metadata files in.

Type: directory
-n | --packagename PACKAGENAME
Optional

The name of the package to associate with the metadata-formatted files.

Type: string
-x | --manifest MANIFEST
Optional

The complete path to the manifest (package.xml) file that specifies the metadata types to convert.

If you specify this parameter, don’t specify --metadata or --sourcepath.

Type: string
-p | --sourcepath SOURCEPATH
Optional

A comma-separated list of paths to the local source files to convert. The supplied paths can be to a single file (in which case the operation is applied to only one file) or to a folder (in which case the operation is applied to all metadata types in the directory and its sub-directories).

If you specify this parameter, don’t specify --manifest or --metadata.

Type: array
-m | --metadata METADATA
Optional

A comma-separated list of metadata component names to convert.

Type: array

force:source:delete

Deletes source files from your project and from a non-source-tracked org.

Help for force:source:delete

Use this command to delete components from orgs that don’t have source tracking.

To remove deleted items from scratch orgs, which have change tracking, use "sfdx force:source:push".

Examples:

1$ sfdx force:source:delete -p path/to/source
1$ sfdx force:source:delete -m <metadata>

Command Syntax

sfdx force:source:delete
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-c]
[-r]
[-w WAIT]
[-p SOURCEPATH]
[-m METADATA]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-c | --checkonly
Optional

Validates the deleted metadata and runs all Apex tests, but prevents the deletion from being saved to the org.

If you change a field type from Master-Detail to Lookup or vice versa, that change isn’t supported when using the --checkonly parameter to test a deletion (validation). This kind of change isn’t supported for test deletions to avoid the risk of data loss or corruption. If a change that isn’t supported for test deletions is included in a deletion package, the test deletion fails and issues an error.

If your deletion package changes a field type from Master-Detail to Lookup or vice versa, you can still validate the changes prior to deploying to Production by performing a full deletion to another test Sandbox. A full deletion includes a validation of the changes as part of the deletion process.

Note: A Metadata API deletion that includes Master-Detail relationships deletes all detail records in the Recycle Bin in the following cases.

1. For a deletion with a new Master-Detail field, soft delete (send to the Recycle Bin) all detail records before proceeding to delete the Master-Detail field, or the deletion fails. During the deletion, detail records are permanently deleted from the Recycle Bin and cannot be recovered.

2. For a deletion that converts a Lookup field relationship to a Master-Detail relationship, detail records must reference a master record or be soft-deleted (sent to the Recycle Bin) for the deletion to succeed. However, a successful deletion permanently deletes any detail records in the Recycle Bin.

Type: boolean
-r | --noprompt
Optional

Do not prompt for delete confirmation.

Type: boolean
-w | --wait WAIT
Optional

Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.

Type: minutes
Default value: 33 minutes
-p | --sourcepath SOURCEPATH
Optional

A comma-separated list of paths to the local metadata to delete. The supplied paths can be a single file (in which case the operation is applied to only one file) or a folder (in which case the operation is applied to all metadata types in the directory and its sub-directories).

If you specify this parameter, don’t specify --manifest or --metadata.

Type: array
-m | --metadata METADATA
Optional

A comma-separated list of names of metadata components to delete from your project and your org.

Type: array

force:source:deploy

Deploys metadata in source format to an org.

Help for force:source:deploy

Use this command to deploy source (metadata that’s in source format) to an org.

To take advantage of change tracking with scratch orgs, use "sfdx force:source:push".

To deploy metadata that’s in metadata format, use "sfdx force:mdapi:deploy".

The source you deploy overwrites the corresponding metadata in your org. This command does not attempt to merge your source with the versions in your org.

To run the command asynchronously, set --wait to 0, which immediately returns the job ID. This way, you can continue to use the CLI.

To check the status of the job, use force:source:deploy:report.

If the comma-separated list you’re supplying contains spaces, enclose the entire comma-separated list in one set of double quotes. On Windows, if the list contains commas, also enclose the entire list in one set of double quotes.

Examples:

To deploy the source files in a directory:

1$ sfdx force:source:deploy -p path/to/source

To deploy a specific Apex class and the objects whose source is in a directory:

1$ sfdx force:source:deploy -p "path/to/apex/classes/MyClass.cls,path/to/source/objects"

To deploy source files in a comma-separated list that contains spaces:

1$ sfdx force:source:deploy -p "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"

To deploy all Apex classes:

1$ sfdx force:source:deploy -m ApexClass

To deploy a specific Apex class:

1$ sfdx force:source:deploy -m ApexClass:MyApexClass

To deploy all custom objects and Apex classes:

1$ sfdx force:source:deploy -m "CustomObject,ApexClass"

To deploy all Apex classes and two specific profiles (one of which has a space in its name):

1$ sfdx force:source:deploy -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"

To deploy all components listed in a manifest:

1$ sfdx force:source:deploy -x path/to/package.xml

To run the tests that aren’t in any managed packages as part of a deployment:

1$ sfdx force:source:deploy -m ApexClass -l RunLocalTests

To check whether a deployment would succeed (to prepare for Quick Deploy):

1$ sfdx force:source:deploy -m ApexClass -l RunAllTestsInOrg -c

To deploy an already validated deployment (Quick Deploy):

1$ sfdx force:source:deploy -q 0Af9A00000FTM6pSAH

Command Syntax

sfdx force:source:deploy
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-c]
[--soapdeploy]
[-w WAIT]
[-l TESTLEVEL]
[-r RUNTESTS]
[-o]
[-g]
[-q VALIDATEDDEPLOYREQUESTID]
[--verbose]
[-m METADATA]
[-p SOURCEPATH]
[-x MANIFEST]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-c | --checkonly
Optional

Validates the deployed metadata and runs all Apex tests, but prevents the deployment from being saved to the org.

If you change a field type from Master-Detail to Lookup or vice versa, that change isn’t supported when using the --checkonly parameter to test a deployment (validation). This kind of change isn’t supported for test deployments to avoid the risk of data loss or corruption. If a change that isn’t supported for test deployments is included in a deployment package, the test deployment fails and issues an error.

If your deployment package changes a field type from Master-Detail to Lookup or vice versa, you can still validate the changes prior to deploying to Production by performing a full deployment to another test Sandbox. A full deployment includes a validation of the changes as part of the deployment process.

Note: A Metadata API deployment that includes Master-Detail relationships deletes all detail records in the Recycle Bin in the following cases.

1. For a deployment with a new Master-Detail field, soft delete (send to the Recycle Bin) all detail records before proceeding to deploy the Master-Detail field, or the deployment fails. During the deployment, detail records are permanently deleted from the Recycle Bin and cannot be recovered.

2. For a deployment that converts a Lookup field relationship to a Master-Detail relationship, detail records must reference a master record or be soft-deleted (sent to the Recycle Bin) for the deployment to succeed. However, a successful deployment permanently deletes any detail records in the Recycle Bin.

Type: boolean
--soapdeploy
Optional

Deploy metadata with SOAP API instead of REST API.

Type: boolean
-w | --wait WAIT
Optional

Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.

Type: minutes
Default value: 33 minutes
-l | --testlevel TESTLEVEL
Optional

Specifies which level of deployment tests to run. Valid values are:

NoTestRun—No tests are run. This test level applies only to deployments to development environments, such as sandbox, Developer Edition, or trial orgs. This test level is the default for development environments.

RunSpecifiedTests—Runs only the tests that you specify in the --runtests option. Code coverage requirements differ from the default coverage requirements when using this test level. Executed tests must comprise a minimum of 75% code coverage for each class and trigger in the deployment package. This coverage is computed for each class and trigger individually and is different than the overall coverage percentage.

RunLocalTests—All tests in your org are run, except the ones that originate from installed managed packages. This test level is the default for production deployments that include Apex classes or triggers.

RunAllTestsInOrg—All tests in your org are run, including tests of managed packages.

If you don’t specify a test level, the default behavior depends on the contents of your deployment package. For more information, see “Running Tests in a Deployment” in the Metadata API Developer Guide.

Type: enum
Permissible values are: NoTestRun, RunSpecifiedTests, RunLocalTests, RunAllTestsInOrg
-r | --runtests RUNTESTS
Optional

Lists the Apex classes containing the deployment tests to run. Use this parameter when you set --testlevel to RunSpecifiedTests.

Type: array
-o | --ignoreerrors
Optional

Ignores the deploy errors, and continues with the deploy operation. The default is false. Keep this parameter set to false when deploying to a production org. If set to true, components without errors are deployed, and components with errors are skipped.

Type: boolean
-g | --ignorewarnings
Optional

If a warning occurs and ignoreWarnings is set to true, the success field in DeployMessage is true. When ignoreWarnings is set to false, success is set to false, and the warning is treated like an error.

This field is available in API version 18.0 and later. Prior to version 18.0, there was no distinction between warnings and errors. All problems were treated as errors and prevented a successful deployment.

Type: boolean
-q | --validateddeployrequestid VALIDATEDDEPLOYREQUESTID
Optional

Specifies the ID of a package with recently validated components to run a Quick Deploy. Deploying a validation helps you shorten your deployment time because tests aren’t rerun. If you have a recent successful validation, you can deploy the validated components without running tests. A validation doesn’t save any components in the org. You use a validation only to check the success or failure messages that you would receive with an actual deployment. To validate your components, add the -c | --checkonly flag when you run "sfdx force:mdapi:deploy". This flag sets the checkOnly="true" parameter for your deployment. Before deploying a recent validation, ensure that the following requirements are met:

1. The components have been validated successfully for the target environment within the last 10 days.

2. As part of the validation, Apex tests in the target org have passed.

3. Code coverage requirements are met.

- If all tests in the org or all local tests are run, overall code coverage is at least 75%, and Apex triggers have some coverage.

- If specific tests are run with the RunSpecifiedTests test level, each class and trigger that was deployed is covered by at least 75% individually.

Type: id
--verbose
Optional

Indicates that you want verbose output from the deploy operation.

Type: boolean
-m | --metadata METADATA
Optional

A comma-separated list of names of metadata components to deploy to the org.

Type: array
-p | --sourcepath SOURCEPATH
Optional

A comma-separated list of paths to the local source files to deploy. The supplied paths can be to a single file (in which case the operation is applied to only one file) or to a folder (in which case the operation is applied to all metadata types in the directory and its sub-directories).

If you specify this parameter, don’t specify --manifest or --metadata.

Type: array
-x | --manifest MANIFEST
Optional

The complete path for the manifest (package.xml) file that specifies the components to deploy. All child components are included.

If you specify this parameter, don’t specify --metadata or --sourcepath.

Type: filepath

force:source:deploy:cancel

Cancels an asynchronous source deployment.

Help for force:source:deploy:cancel

Use this command to cancel a specified asynchronous source deployment. You can also specify a wait time (in minutes) to check for updates to the canceled deploy status.

To run the command asynchronously, set --wait to 0, which immediately returns the job ID. This way, you can continue to use the CLI.

To check the status of the job, use force:source:deploy:report.

Examples:

Deploy a directory of files to the org

1$ sfdx force:source:deploy -d <directory>

Now cancel this deployment and wait two minutes

1$ sfdx force:source:deploy:cancel -w 2

If you have multiple deployments in progress and want to cancel a specific one, specify the job ID

1$ sfdx force:source:deploy:cancel -i <jobid>

Check the status of the cancel job

1$ sfdx force:source:deploy:report

Command Syntax

sfdx force:source:deploy:cancel
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-i JOBID]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-w | --wait WAIT
Optional

Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.

Type: minutes
Default value: 33 minutes
-i | --jobid JOBID
Optional

The job ID (requestId) of the deployment you want to cancel. If not specified, the default value is the ID of the most recent source deployment you ran using Salesforce CLI.

Type: id

force:source:deploy:report

Checks the current status of an asynchronous metadata deployment.

Help for force:source:deploy:report

Specify the job ID for the deploy you want to check. You can also specify a wait time (minutes) to check for updates to the deploy status.

Examples:

Deploy a directory of files to the org

1$ sfdx force:source:deploy -d <directory>

Now cancel this deployment and wait two minutes

1$ sfdx force:source:deploy:cancel -w 2

If you have multiple deployments in progress and want to cancel a specific one, specify the job ID

1$ sfdx force:source:deploy:cancel -i <jobid>

Check the status of the cancel job

1$ sfdx force:source:deploy:report

Command Syntax

sfdx force:source:deploy:report
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-i JOBID]
[--verbose]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-w | --wait WAIT
Optional

Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.

Type: minutes
Default value: 33 minutes
-i | --jobid JOBID
Optional

The job ID (asyncId) of the deployment you want to check. If not specified, the default value is the ID of the most recent metadata deployment you ran using Salesforce CLI. Use with -w to resume waiting.

Type: id
--verbose
Optional

Emit additional command output to stdout.

Type: boolean

force:source:ignored:list

Check your local project package directories for forceignored files.

Help for force:source:ignored:list

Check your local project's package directories for forceignored files.

Use the --sourcepath parameter to limit the check to a specific file or directory. If you specify a directory, the command checks all sub-directories recursively.

Command Syntax

sfdx force:source:ignored:list
[--json]
[--loglevel LOGLEVEL]
[-p SOURCEPATH]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-p | --sourcepath SOURCEPATH
Optional

File or directory of files that the command checks for foreceignored files.

Type: filepath

force:source:manifest:create

Create a project manifest that lists the metadata components you want to deploy or retrieve .

Help for force:source:manifest:create

Create a manifest from a list of metadata components (--metadata) or from one or more local directories that contain source files (--sourcepath). You can specify either of these parameters, not both.

Use --manifesttype to specify the type of manifest you want to create. The resulting manifest files have specific names, such as the standard package.xml or destructiveChanges.xml to delete metadata. Valid values for this parameter, and their respective file names, are:

package : package.xml (default)

pre : destructiveChangesPre.xml

post : destructiveChangesPost.xml

destroy : destructiveChanges.xml

See https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_deleting_files.htm for information about these destructive manifest files.

Use --manifestname to specify a custom name for the generated manifest if the pre-defined ones don’t suit your needs. You can specify either --manifesttype or --manifestname, but not both.

Examples for force:source:manifest:create

1$ sfdx force:source:manifest:create -m ApexClass
1$ sfdx force:source:manifest:create -m ApexClass:MyApexClass --manifesttype destroy
1$ sfdx force:source:manifest:create --sourcepath force-app --manifestname myNewManifest

Command Syntax

sfdx force:source:manifest:create
[--json]
[--loglevel LOGLEVEL]
[--apiversion APIVERSION]
[-m METADATA]
[-p SOURCEPATH]
[-n MANIFESTNAME]
[-t MANIFESTTYPE]
[-o OUTPUTDIR]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-m | --metadata METADATA
Optional

Comma-separated list of names of metadata components to include in the manifest.

Type: array
-p | --sourcepath SOURCEPATH
Optional

Comma-separated list of paths to the local source files to include in the manifest.

Type: array
-n | --manifestname MANIFESTNAME
Optional

Name of a custom manifest file to create.

Type: string
-t | --manifesttype MANIFESTTYPE
Optional

Type of manifest to create; the type determines the name of the created file.

Type: enum
Permissible values are: pre, post, destroy, package
-o | --outputdir OUTPUTDIR
Optional

Directory to save the created manifest.

Type: string

force:source:open

Opens the specified Lightning Page in Lightning App Builder. Lightning Page files have the suffix .flexipage-meta.xml, and are stored in the flexipages directory. If you specify a different type of file, this command opens your org’s home page.

Help for force:source:open

The file opens in your default browser.

If no browser-based editor is available for the selected file, this command opens your org’s home page.

To generate a URL for the browser-based editor but not open the editor, use --urlonly.

Examples:

1$ sfdx force:source:open -f Property_Record_Page.flexipage-meta.xml
1$ sfdx force:source:open -f Property_Record_Page.flexipage-meta.xml -r

Command Syntax

sfdx force:source:open
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-f SOURCEFILE
[-r]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-f | --sourcefile SOURCEFILE
Required

File to edit.

Type: filepath
-r | --urlonly
Optional

Generate a navigation URL path, but don’t launch a browser-based editor.

Type: boolean

force:source:pull

Pulls changed source from the scratch org to your project to keep them in sync.

Help for force:source:pull

If the command detects a conflict, it displays the conflicts but does not complete the process. After reviewing the conflict, rerun the command with the --forceoverwrite parameter.

Command Syntax

sfdx force:source:pull
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-f]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-w | --wait WAIT
Optional

The number of minutes to wait for the command to complete and display results to the terminal window. If the command continues to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.

Type: minutes
Default value: 33 minutes
-f | --forceoverwrite
Optional

Runs the pull command even if conflicts exist. Changes in the scratch org overwrite changes in the project.

Type: boolean

force:source:push

Pushes changed source from your project to a scratch org to keep them in sync.

Help for force:source:push

If the command detects a conflict, it displays the conflicts but does not complete the process. After reviewing the conflict, rerun the command with the --forceoverwrite parameter.

Command Syntax

sfdx force:source:push
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-f]
[-g]
[-w WAIT]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-f | --forceoverwrite
Optional

Runs the push command even if conflicts exist. Changes in the project overwrite changes in the scratch org.

Type: boolean
-g | --ignorewarnings
Optional

Completes the deployment even if warnings are generated.

Type: boolean
-w | --wait WAIT
Optional

Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.

Type: minutes
Default value: 33 minutes

force:source:retrieve

Retrieves metadata in source format from an org to your local Salesforce DX project.

Help for force:source:retrieve

Use this command to retrieve source (metadata that’s in source format) from an org.

To take advantage of change tracking with scratch orgs, use "sfdx force:source:pull".

To retrieve metadata that’s in metadata format, use "sfdx force:mdapi:retrieve".

The source you retrieve overwrites the corresponding source files in your local project. This command does not attempt to merge the source from your org with your local source files.

If the comma-separated list you’re supplying contains spaces, enclose the entire comma-separated list in one set of double quotes. On Windows, if the list contains commas, also enclose it in one set of double quotes.

Examples:

To retrieve the source files in a directory:

1$ sfdx force:source:retrieve -p path/to/source

To retrieve a specific Apex class and the objects whose source is in a directory:

1$ sfdx force:source:retrieve -p "path/to/apex/classes/MyClass.cls,path/to/source/objects"

To retrieve source files in a comma-separated list that contains spaces:

1$ sfdx force:source:retrieve -p "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"

To retrieve all Apex classes:

1$ sfdx force:source:retrieve -m ApexClass

To retrieve a specific Apex class:

1$ sfdx force:source:retrieve -m ApexClass:MyApexClass

To retrieve all custom objects and Apex classes:

1$ sfdx force:source:retrieve -m "CustomObject,ApexClass"

To retrieve all Apex classes and two specific profiles (one of which has a space in its name):

1$ sfdx force:source:retrieve -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"

To retrieve all metadata components listed in a manifest:

1$ sfdx force:source:retrieve -x path/to/package.xml

To retrieve metadata from a package or multiple packages:

1$ sfdx force:source:retrieve -n MyPackageName
1$ sfdx force:source:retrieve -n "Package1, PackageName With Spaces, Package3"

To retrieve all metadata from a package and specific components that aren’t in the package, specify both -n | --packagenames and one other scoping parameter:

1$ sfdx force:source:retrieve -n MyPackageName -p path/to/apex/classes
1$ sfdx force:source:retrieve -n MyPackageName -m ApexClass:MyApexClass
1$ sfdx force:source:retrieve -n MyPackageName -x path/to/package.xml

Command Syntax

sfdx force:source:retrieve
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[-a APIVERSION]
[-w WAIT]
[-x MANIFEST]
[-m METADATA]
[-n PACKAGENAMES]
[-p SOURCEPATH]
[--verbose]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
-a | --apiversion APIVERSION
Optional

Use to override the default, which is the latest version supported by your CLI plug-in, with the version in your package.xml file.

Type: string
-w | --wait WAIT
Optional

Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.

Type: minutes
Default value: 33 minutes
-x | --manifest MANIFEST
Optional

The complete path for the manifest (package.xml) file that specifies the components to retrieve.

If you specify this parameter, don’t specify --metadata or --sourcepath.

Type: filepath
-m | --metadata METADATA
Optional

A comma-separated list of names of metadata components to retrieve from the org.

Type: array
-n | --packagenames PACKAGENAMES
Optional

A comma-separated list of package names to retrieve.

Type: array
-p | --sourcepath SOURCEPATH
Optional

A comma-separated list of file paths for source to retrieve from the org. The supplied paths can be to a single file (in which case the operation is applied to only one file) or to a folder (in which case the operation is applied to all source files in the directory and its sub-directories).

Type: array
--verbose
Optional

Indicates that you want verbose output from the retrieve operation.

Type: boolean

force:source:status

Lists changes that have been made locally, in a scratch org, or both.

Help for force:source:status

Examples:

1$ sfdx force:source:status -l
1$ sfdx force:source:status -r
1$ sfdx force:source:status -a
1$ sfdx force:source:status -a -u me@example.com --json

Command Syntax

sfdx force:source:status
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-a]
[-l]
[-r]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-a | --all
Optional

Lists all the changes that have been made.

Type: boolean
-l | --local
Optional

Lists the changes that have been made locally.

Type: boolean
-r | --remote
Optional

Lists the changes that have been made in the scratch org.

Type: boolean

force:source:tracking:clear

Clear all local source tracking information.

Help for force:source:tracking:clear

WARNING: This command deletes or overwrites all existing source tracking files. Use with extreme caution.

Clears all local source tracking information. When you next run force:source:status, the CLI displays all local and remote files as changed, and any files with the same name are listed as conflicts.

Command Syntax

sfdx force:source:tracking:clear
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-p]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-p | --noprompt
Optional

Do not prompt for source tracking override confirmation.

Type: boolean

force:source:tracking:reset

Reset local and remote source tracking.

Help for force:source:tracking:reset

WARNING: This command deletes or overwrites all existing source tracking files. Use with extreme caution.

Resets local and remote source tracking so that the CLI no longer registers differences between your local files and those in the org. When you next run force:source:status, the CLI returns no results, even though conflicts might actually exist. The CLI then resumes tracking new source changes as usual.

Use the --revision parameter to reset source tracking to a specific revision number of an org source member. To get the revision number, query the SourceMember Tooling API object with the force:data:soql:query command. For example:

1$ sfdx force:data:soql:query -q "SELECT MemberName, MemberType, RevisionCounter FROM SourceMember" -t

Command Syntax

sfdx force:source:tracking:reset
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-r REVISION]
[-p]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-r | --revision REVISION
Optional

Reset to a specific SourceMember revision counter number.

Type: integer
-p | --noprompt
Optional

Do not prompt for source tracking override confirmation.

Type: boolean