Salesforce CLI plugin with git-based commands for deploying, retrieving, and managing org metadata.
sf plugins install sf-git-pluginOr link locally during development:
npm install
npm run build
sf plugins link .Deploy source files to the org.
sf git deploy force-app/main/default/classes/MyClass.cls --target-org myorg
sf git deploy force-app/main/default/classes force-app/main/default/triggers --target-org myorg
sf git deploy force-app/main/default/classes/MyClass.cls -c --target-org myorg # ignore conflictsFlags:
--target-org— target org username or alias (required)--api-version— API version override-c, --ignore-conflicts— ignore conflicts during deployment
Retrieve source files from the org into the default package directory.
sf git retrieve force-app/main/default/classes/MyClass.cls --target-org myorg
sf git retrieve force-app/main/default/classes force-app/main/default/triggers --target-org myorgFlags:
--target-org— target org username or alias (required)--api-version— API version override
Delete source components from the org (destructive deployment).
sf git delete force-app/main/default/classes/OldClass.cls --target-org myorgFlags:
--target-org— target org username or alias (required)--api-version— API version override
Validate a deployment without deploying. Supports validating from source paths or a release folder containing package.xml and tests.txt.
sf git validate force-app/main/default/classes/MyClass.cls --target-org myorg
sf git validate releases/v1.0 --manifest --target-org myorgFlags:
--target-org— target org username or alias (required)--api-version— API version override-m, --manifest— validate usingpackage.xmlandtests.txtfrom a release folder
When --manifest is used, the argument is a folder path containing:
package.xml— components to validatetests.txt— whitespace-separated list of Apex test class names to run
Generate a package.xml from source files and copy it to the clipboard (macOS). Optionally deploy or retrieve immediately after.
sf git manifest force-app/main/default/classes/MyClass.cls
sf git manifest force-app/main/default/classes --deploy --target-org myorg
sf git manifest force-app/main/default/classes --retrieve --target-org myorgFlags:
--target-org— target org username or alias (required with--deployor--retrieve)--api-version— API version override-d, --deploy— deploy after generating the manifest-r, --retrieve— retrieve after generating the manifest
Deploy using a package.xml manifest file.
sf git deploy-manifest package.xml --target-org myorg
sf git deploy-manifest releases/v1.0/package.xml --target-org myorgFlags:
--target-org— target org username or alias (required)--api-version— API version override
Retrieve using a package.xml manifest file into the default package directory.
sf git retrieve-manifest package.xml --target-org myorg
sf git retrieve-manifest releases/v1.0/package.xml --target-org myorgFlags:
--target-org— target org username or alias (required)--api-version— API version override
Run Apex test classes by name and display results.
sf git tests MyClassTest --target-org myorg
sf git tests MyClassTest AnotherTest --target-org myorgFlags:
--target-org— target org username or alias (required)--api-version— API version override
Tail org debug logs, printing only USER_DEBUG and FATAL_ERROR lines. Press Ctrl+C to stop.
sf git log --target-org myorgFlags:
--target-org— target org username or alias (required)--api-version— API version override
npm install
npm run build