Skip to main content

Useful Command reference

Base

sf org login web --alias MyOrg

Login

git add . && git commit -m "My Commit Message" && git push

quick and dirty commit everything from local

git remote update origin --prune

get all Branches from remote and remove the deleted ones from your local

Deployments

sf project retrieve start --target-org MyOrg --ignore-conflicts --wait 20  

Retrieve changes from Org. Assumes Source Tracking is on.

sf project retrieve start --target-org MyOrg --ignore-conflicts --wait 20  -x manifest/package.xml

Get the metadata listed in the package from the Org

sf project retrieve start --target-org MyOrg --ignore-conflicts --wait 20  -m InstalledPackage:FSL

Retrieve specific metadata from the org. Based on the Metadata Types from SF https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_types_list.htm

sf project deploy start --target-org MyOrg --ignore-conflicts --wait 20

Deploy the source. Does destructive changes and assumes source tracking

sf project deploy start --target-org MyOrg --source-dir force-app --ignore-conflicts --wait 20

Deploy the metadata contained in the force-app folder. Does not do destructive changes.

sf project deploy start --target-org MyOrg --manifest package/package.xml --pre-destructive-changes destructiveChanges/destructiveChanges.xml --ignore-conflicts --ignore-warnings --wait 20 --dry-run

Same as previous but validates only

 

Using SGD

sf sgd:source:delta --to HEAD --from HEAD~1 --output-dir . -i .sgdignore

sgd - do delta from last commit to current commit, generate the package.xml and destructivechanges in the current directory, and ignore directories listed in .sgdignore

sf project deploy start --target-org MyOrg --manifest package/package.xml --pre-destructive-changes destructiveChanges/destructiveChanges.xml --ignore-conflicts --ignore-warnings --wait 20 --dry-run

sgd - do a Salesforce Project deploy based on the generated manifest from SGD, and do destructive changes before running anything else based on the destructivechanges.xml