Newer Version Available
source Commands
source:convert
Command Syntax
- sfdx force:source:convert
- [-r ROOTDIR]
- [-d OUTPUTDIR]
- [-n PACKAGENAME]
- [--json]
- [--loglevel LOGLEVEL]
Parameters
- -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
- --json
- Optional
-
Format output as JSON.
- Type: flag
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: string
- Permissible values are: trace, debug, info, warn, error, fatal
- Default value: error
Help for source:convert
NOTE: This command must be run from within a project.
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:
source:delete (Beta)
Command Syntax
- sfdx force:source:delete
- [-r]
- [-w WAIT]
- [-p SOURCEPATH]
- [-m METADATA]
- [-u TARGETUSERNAME]
- [--json]
- [--loglevel LOGLEVEL]
Parameters
- -r | --noprompt
- Optional
-
Do not prompt for delete confirmation.
- Type: flag
- -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
- -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: filepath
- -m | --metadata METADATA
- Optional
-
A comma-separated list of names of metadata components to delete from your project and your org.
- Type: string
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --json
- Optional
-
Format output as JSON.
- Type: flag
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: string
- Permissible values are: trace, debug, info, warn, error, fatal
- Default value: error
Help for source:delete
NOTE: This command must be run from within a project.
Use this command to delete components from orgs that don’t have source tracking, such as sandboxes.
To remove deleted items from scratch orgs, which have change tracking, use "sfdx force:source:push".
Examples:
source:deploy (Beta)
Command Syntax
- sfdx force:source:deploy
- [-w WAIT]
- [-m METADATA]
- [-p SOURCEPATH]
- [-x MANIFEST]
- [-u TARGETUSERNAME]
- [--json]
- [--loglevel LOGLEVEL]
Parameters
- -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
- -m | --metadata METADATA
- Optional
-
A comma-separated list of names of metadata components to deploy to the org.
- Type: string
- -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: filepath
- -x | --manifest MANIFEST
- Optional
-
The complete path for the manifest (package.xml) file that specifies the components to deploy.
If you specify this parameter, don’t specify --metadata or --sourcepath.
- Type: filepath
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --json
- Optional
-
Format output as JSON.
- Type: flag
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: string
- Permissible values are: trace, debug, info, warn, error, fatal
- Default value: error
Help for source:deploy
NOTE: This command must be run from within a project.
Use this command to deploy source to orgs that don’t have source tracking, such as sandboxes.
To push source to scratch orgs, which have change tracking, use "sfdx force:source:push".
To deploy metadata that’s in the Metadata API 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.
If the comma-separated list you’re supplying contains spaces, enclose the entire comma-separated list in one set of double quotes.
Examples:
To deploy the source files in a directory:
To deploy a specific Apex class and the objects whose source is in a directory:
To deploy source files in a comma-separated list that contains spaces:
To deploy all Apex classes:
To deploy a specific Apex class:
To deploy all custom objects and Apex classes:
To deploy all Apex classes and two specific profiles (one of which has a space in its name):
To deploy all components listed in a manifest:
source:open
Command Syntax
- sfdx force:source:open
- -f SOURCEFILE
- [-r]
- [-u TARGETUSERNAME]
- [--json]
- [--loglevel LOGLEVEL]
Parameters
- -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: flag
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --json
- Optional
-
Format output as JSON.
- Type: flag
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: string
- Permissible values are: trace, debug, info, warn, error, fatal
- Default value: error
Help for source:open
NOTE: This command must be run from within a project.
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:
source:pull
Command Syntax
- sfdx force:source:pull
- [-w WAIT]
- [-f]
- [-u TARGETUSERNAME]
- [--json]
- [--loglevel LOGLEVEL]
Parameters
- -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
- -f | --forceoverwrite
- Optional
-
Runs the pull command even if conflicts exist. Changes in the scratch org overwrite changes in the project.
- Type: flag
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --json
- Optional
-
Format output as JSON.
- Type: flag
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: string
- Permissible values are: trace, debug, info, warn, error, fatal
- Default value: error
Help for source:pull
NOTE: This command must be run from within a project.
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.
source:push
Command Syntax
- sfdx force:source:push
- [-f]
- [-g]
- [-w WAIT]
- [-u TARGETUSERNAME]
- [--json]
- [--loglevel LOGLEVEL]
Parameters
- -f | --forceoverwrite
- Optional
-
Runs the push command even if conflicts exist. Changes in the project overwrite changes in the scratch org.
- Type: flag
- -g | --ignorewarnings
- Optional
-
Completes the deployment even if warnings are generated.
- Type: flag
- -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
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --json
- Optional
-
Format output as JSON.
- Type: flag
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: string
- Permissible values are: trace, debug, info, warn, error, fatal
- Default value: error
Help for source:push
NOTE: This command must be run from within a project.
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.
source:retrieve (Beta)
Command Syntax
- sfdx force:source:retrieve
- [-w WAIT]
- [-x MANIFEST]
- [-m METADATA]
- [-p SOURCEPATH]
- [-u TARGETUSERNAME]
- [--json]
- [--loglevel LOGLEVEL]
Parameters
- -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
- -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: string
- -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: filepath
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --json
- Optional
-
Format output as JSON.
- Type: flag
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: string
- Permissible values are: trace, debug, info, warn, error, fatal
- Default value: error
Help for source:retrieve
NOTE: This command must be run from within a project.
Use this command to retrieve source from orgs that don’t have source tracking, such as sandboxes.
To pull source from scratch orgs, which have change tracking, use "sfdx force:source:pull".
To retrieve metadata that’s in the Metadata API 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.
Examples:
To retrieve the source files in a directory:
To retrieve a specific Apex class and the objects whose source is in a directory:
To retrieve source files in a comma-separated list that contains spaces:
To retrieve all Apex classes:
To retrieve a specific Apex class:
To retrieve all custom objects and Apex classes:
To retrieve all Apex classes and two specific profiles (one of which has a space in its name):
To retrieve all metadata components listed in a manifest:
source:status
Command Syntax
- sfdx force:source:status
- [-a]
- [-l]
- [-r]
- [-u TARGETUSERNAME]
- [--json]
- [--loglevel LOGLEVEL]
Parameters
- -a | --all
- Optional
-
Lists all the changes that have been made.
- Type: flag
- -l | --local
- Optional
-
Lists the changes that have been made locally.
- Type: flag
- -r | --remote
- Optional
-
Lists the changes that have been made in the scratch org.
- Type: flag
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --json
- Optional
-
Format output as JSON.
- Type: flag
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: string
- Permissible values are: trace, debug, info, warn, error, fatal
- Default value: error
Help for source:status
NOTE: This command must be run from within a project.
Examples: