Newer Version Available

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

source Commands

Use the source commands to push and pull source to and from your scratch orgs, to see synchronization changes between your project and scratch orgs, and to prepare your source for deployment to non-scratch orgs.

source:convert

Converts source in a Salesforce DX project into metadata that you can deploy using Metadata API.

Command Syntax

sfdx force:source:convert
[-r ROOTDIR]
[-d OUTPUTDIR]
[-n PACKAGENAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-r | --rootdir ROOTDIR
Optional

The directory that contains the Salesforce DX–formatted source to convert.

Type: directory
-d | --outputdir OUTPUTDIR
Optional

The output directory to export the Metadata API–formatted metadata to.

Type: directory
-n | --packagename PACKAGENAME
Optional

The name of the package to associate with the Metadata API–formatted metadata.

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

This command must be run in a project.

To convert Salesforce DX–formatted source into a format that you can deploy using Metadata API, run "sfdx force:source:convert". Then deploy the metadata using "sfdx force:mdapi:deploy".

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

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

Examples:

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.

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

This command must be run in 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

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

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

This command must be run in 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

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

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

This command must be run in 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:status

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

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

This command must be run in a project.

Examples: