Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
All snippets
Salesforce CLI

sf project deploy: deploy only changed files

Use git to diff against main and pass the changed files to `sf project deploy start`. Cuts deploy times from minutes to seconds in large repos.

# Deploy only metadata that changed vs the main branch.
git fetch origin main
git diff --name-only --diff-filter=ACMR origin/main...HEAD \
  -- 'force-app/**' \
  | xargs -I {} sf project deploy start --source-dir {}

# To preview without deploying:
git diff --name-only --diff-filter=ACMR origin/main...HEAD -- 'force-app/**'

Notes

Related dictionary terms

More snippets