# Source-driven deployment with Salesforce CLI and packages

*Platform Developer II Study Guide · Testing, Debugging, and Deployment · Last updated October 16, 2026 · https://www.certifyforce.com/study-guide/platform-developer-ii/testing-debugging-and-deployment/source-driven-deployment-with-salesforce-cli-and-packages*

Convert metadata to source format, use .forceignore and source tracking with conflict resolution, choose test levels and per-class coverage, validate then quick deploy or dry-run, delete components with destructive manifests, shape scratch orgs, release unlocked packages, authorize CI with JWT, and pick DevOps Center over change sets.

- Certification: Salesforce Platform Developer II
- Exam section: Testing, Debugging, and Deployment
- Study guide: https://www.certifyforce.com/study-guide/platform-developer-ii

**Official exam objective:**

> Given a scenario, formulate the deployment process, supporting tools, and mechanisms for source-driven development.

## What the exam expects

- Convert Metadata API files to source format, exclude files with `.forceignore`, and resolve source-tracking conflicts.
- Predict which tests run and which coverage rule applies for each test level, and plan validate plus quick deploy or a sandbox dry run.
- Delete components with destructive changes manifests and shape scratch orgs with a definition file.
- Release an unlocked package version, authorize an unattended pipeline with JWT, and recommend DevOps Center over change sets.

Key terms: **source format** (the decomposed DX file shape, versus Metadata API's metadata format); **source tracking** (the CLI's local record of changes between a project and a scratch org or sandbox); **test level** (which Apex tests a deployment runs); **quick deploy** (deploying a successful validation without rerunning tests); **destructive changes manifest** (a package.xml-shaped file listing components to delete).

This unit assumes the Platform Developer guide's *Salesforce DX, the CLI and Developer Console* and *Sandboxes, change sets and deploying code*.

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Metadata to source format | `sf project convert mdapi --root-dir` | [Convert Files in Metadata Format to Source Format](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_convert_mdapi.htm) |
| Exclude files | `.forceignore`, same pattern rules as `.gitignore` | [How to Exclude Source When Syncing](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm) |
| Source tracking orgs | Scratch orgs by default; Developer and Developer Pro sandboxes once enabled | [Enable Source Tracking in Sandboxes](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_setup_enable_source_tracking_sandboxes.htm), [project deploy start](https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_project_deploy_start.html) |
| Overwrite org after a conflict | `deploy start --ignore-conflicts` on the merged component | [Resolve Conflicts Between Your Local Project and Org](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_source_tracking_resolve_conflicts.htm) |
| Default production test run | Local tests when the package has Apex classes or triggers | [Running Tests in a Deployment](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_running_tests.htm) |
| RunSpecifiedTests coverage | 75% per deployed class and trigger | [Running a Subset of Tests in a Deployment](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_run_specific_tests.htm) |
| Quick deploy window | 10 days from when the validation started | [project deploy quick](https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_project_deploy_quick.html) |
| Sandbox validation with tests | `deploy start --dry-run --test-level RunLocalTests` | [project deploy validate](https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_project_deploy_validate.html) |
| Delete after deploy | `--post-destructive-changes` | [project deploy start](https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_project_deploy_start.html) |
| Package promotion | Validated, 75% coverage via `--code-coverage` (not calculated for org-dependent packages) | [Code Coverage for Unlocked Packages](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_unlocked_pkg_code_coverage.htm) |

## Check yourself

- Why can't a flagless `sf project deploy start` check for conflicts against a Full sandbox?
- When does a production deployment run no tests by default?
- Why does `sf package version create` need `--code-coverage` before a production release?
- Which file keeps LWC `__tests__` folders out of deploys?
- What does DevOps Center (being renamed Lifecycle Center) add that change sets lack?

## Sources

- [Salesforce DX Project Structure and Source Format](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_source_file_format.htm)
- [Convert Files in Metadata Format to Source Format](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_convert_mdapi.htm)
- [project convert source](https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_project_convert_source.html)
- [How to Exclude Source When Syncing](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm)
- [Track Changes Between Your Project and Org](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_source_tracking.htm)
- [Enable Source Tracking in Sandboxes](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_setup_enable_source_tracking_sandboxes.htm)
- [Resolve Conflicts Between Your Local Project and Org](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_source_tracking_resolve_conflicts.htm)
- [project deploy start](https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_project_deploy_start.html)
- [Running Tests in a Deployment](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_running_tests.htm)
- [Running a Subset of Tests in a Deployment](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_run_specific_tests.htm)
- [project deploy validate](https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_project_deploy_validate.html)
- [project deploy quick](https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_project_deploy_quick.html)
- [deployRecentValidation()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deployRecentValidation.htm)
- [Deleting Components from an Organization](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_deleting_files.htm)
- [Build Your Own Scratch Org Definition File](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file.htm)
- [Scratch Org Features](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file_config_values.htm)
- [Code Coverage for Unlocked Packages](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_unlocked_pkg_code_coverage.htm)
- [Release an Unlocked Package](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_unlocked_pkg_create_pkg_ver_promote.htm)
- [Authorize an Org Using the JWT Flow](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_jwt_flow.htm)
- [Change Sets Best Practices](https://help.salesforce.com/s/articleView?id=sf.changesets_best_practices.htm&language=en_US&type=5)
- [Change Sets Implementation Tips](https://help.salesforce.com/s/articleView?id=sf.changesets_implementation_notes.htm&language=en_US&type=5)
- [Lifecycle Center (formerly DevOps Center)](https://help.salesforce.com/s/articleView?id=platform.devops_center_overview.htm&language=en_US&type=5)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 14 linked practice questions, and unlimited timed mock exams are included with the Platform Developer II pack (USD $19): https://www.certifyforce.com/practice-exams
