{"id":1196,"date":"2026-09-02T09:00:00","date_gmt":"2026-09-02T03:30:00","guid":{"rendered":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/"},"modified":"2026-09-02T09:00:00","modified_gmt":"2026-09-02T03:30:00","slug":"salesforce-cli-deploy-retrieve-metadata","status":"publish","type":"post","link":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/","title":{"rendered":"Salesforce CLI Deploy and Retrieve: Move Metadata Step by Step"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Salesforce CLI Deploy and retrieve commands are how developers move metadata between their computer and their orgs. Deploy sends your files up to an org. Retrieve pulls changes down from an org into your files. Together, they replace most of the clicking you did with change sets.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You already ran a first deploy in our <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-setup-vs-code\/\">Salesforce CLI setup post<\/a>. You also learned the <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-dx-project-structure\/\">project folder layout<\/a> and the <a href=\"https:\/\/swapnilzambare.com\/blog\/scratch-orgs-vs-sandboxes-developer-edition\/\">different org types<\/a>. Now we will learn every common way to deploy and retrieve, including tests and safe production releases.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Salesforce CLI Deploy?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A Salesforce CLI Deploy takes metadata files from your project and sends them to a target org. The org checks the files, compiles any code and saves the changes. If one item fails, the whole deploy rolls back by default, so the org never ends up half-changed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Retrieve does the opposite. It reads metadata from an org and writes it into your project as files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think of your project folder as a shared notebook and the org as a whiteboard in a meeting room. Deploy copies your notes onto the whiteboard. Retrieve copies the whiteboard into your notebook, so you do not lose what someone else wrote.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Salesforce CLI Deploy Matters<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Change sets work only between connected orgs, and you build them by clicking. The CLI is faster and far more flexible.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Any org.<\/strong> Deploy to scratch orgs, sandboxes, Developer Edition orgs or production.<\/li>\n\n<li><strong>Repeatable.<\/strong> The same command gives the same result every time.<\/li>\n\n<li><strong>Scriptable.<\/strong> Pipelines can run the exact commands you type.<\/li>\n\n<li><strong>Testable.<\/strong> You choose which Apex tests run during the deploy.<\/li>\n\n<li><strong>Fast feedback.<\/strong> Errors show up right in your terminal with file names and line numbers.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How Salesforce CLI Deploy and Retrieve Work<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every command needs two answers: what to move, and which org to use. You choose &#8220;what&#8221; with one of three flags. You choose &#8220;which org&#8221; with <code>--target-org<\/code>, or the CLI uses your default org.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-1-1024x640.png\" alt=\"Salesforce CLI Deploy diagram showing deploy and retrieve between a project and an org\" class=\"wp-image-1194\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-1-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-1-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-1-768x480.png 768w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-1-1536x960.png 1536w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-1-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Deploy sends files to an org, and retrieve pulls them back.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The table below shows the three ways to choose what to move.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Flag<\/th><th>What it selects<\/th><th>Good for<\/th><\/tr><\/thead><tbody><tr><td>&#8211;source-dir<\/td><td>A file or folder in your project<\/td><td>Quick deploys while building<\/td><\/tr><tr><td>&#8211;metadata<\/td><td>Named items, like ApexClass:CourseService<\/td><td>One or two exact items<\/td><\/tr><tr><td>&#8211;manifest<\/td><td>Everything listed in package.xml<\/td><td>Planned releases<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Deploy by Folder or File<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is the most common option during daily work. You point at a file or a folder, and the CLI deploys everything inside.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sf project deploy start --source-dir force-app\/main\/default\/classes\/CourseService.cls\nsf project deploy start --source-dir force-app<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first command deploys one Apex class and its meta file. The second command deploys the whole project. Both use your default org.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Deploy by Metadata Name<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can also name the items directly with the type and API name. Separate several items with spaces.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sf project deploy start --metadata ApexClass:CourseService ApexTrigger:CourseTrigger<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This deploys one class and one trigger, as long as their files exist in your project.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Deploy with a Manifest<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A manifest is a file named <code>package.xml<\/code>. It lists every item for a release. Here is one for the Bright Path Tutors course feature.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;Package xmlns=\"http:\/\/soap.sforce.com\/2006\/04\/metadata\"&gt;\n    &lt;types&gt;\n        &lt;members&gt;CourseService&lt;\/members&gt;\n        &lt;members&gt;CourseWelcome&lt;\/members&gt;\n        &lt;name&gt;ApexClass&lt;\/name&gt;\n    &lt;\/types&gt;\n    &lt;types&gt;\n        &lt;members&gt;CourseTrigger&lt;\/members&gt;\n        &lt;name&gt;ApexTrigger&lt;\/name&gt;\n    &lt;\/types&gt;\n    &lt;types&gt;\n        &lt;members&gt;Course__c&lt;\/members&gt;\n        &lt;name&gt;CustomObject&lt;\/name&gt;\n    &lt;\/types&gt;\n    &lt;version&gt;65.0&lt;\/version&gt;\n&lt;\/Package&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Each <code>types<\/code> block holds one metadata type. The <code>members<\/code> tags list the API names, and <code>name<\/code> gives the type. You can let the CLI build this file for you with <code>sf project generate manifest --source-dir force-app<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then deploy it with this command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sf project deploy start --manifest manifest\/package.xml --target-org brightpath-uat<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Salesforce CLI Deploy with Apex Tests<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Production needs tested code, so every Salesforce CLI Deploy to production runs Apex tests. Salesforce requires at least 75% code coverage across your Apex before a production deploy can pass. You control which tests run with <code>--test-level<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Test level<\/th><th>What runs<\/th><th>Typical use<\/th><\/tr><\/thead><tbody><tr><td>NoTestRun<\/td><td>No tests<\/td><td>Sandboxes and scratch orgs only<\/td><\/tr><tr><td>RunSpecifiedTests<\/td><td>Only the tests you list<\/td><td>Fast, focused production deploys<\/td><\/tr><tr><td>RunLocalTests<\/td><td>All tests except managed package tests<\/td><td>Most production deploys<\/td><\/tr><tr><td>RunAllTestsInOrg<\/td><td>Every test, including packages<\/td><td>Rare, full checks<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For example, this deploy runs only the CourseService tests.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sf project deploy start --source-dir force-app --test-level RunSpecifiedTests --tests CourseServiceTest<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">With RunSpecifiedTests, each class and trigger you deploy needs at least 75% coverage from the tests you list. So choose your test classes carefully.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Validate First, Then Quick Deploy<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Big teams rarely deploy straight to production. Instead, they validate first. A validation runs the full deploy and the tests but saves nothing. If it passes, you can release it later with a quick deploy.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sf project deploy validate --manifest manifest\/package.xml --test-level RunLocalTests --target-org production\nsf project deploy quick --job-id 0Af5g00000AbCdEFGH --target-org production<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first command checks everything and prints a job ID. The second command uses that ID to release the same changes in seconds, without running the tests again. A successful validation stays ready for a quick deploy for up to 10 days.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is perfect for release nights. You validate in the afternoon, and you quick deploy in a short evening window. Users see almost no downtime, and the team avoids last-minute surprises. If the validation fails, you still have hours to fix the problem before the window opens.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Retrieving Metadata<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Retrieve uses the same three flags as deploy. Here are the most common examples.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sf project retrieve start --metadata ApexClass:CourseService\nsf project retrieve start --metadata CustomObject:Course__c\nsf project retrieve start --manifest manifest\/package.xml<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first line pulls one class. Next, line two pulls the Course object with its fields, list views and rules. Finally, line three pulls everything in the manifest. In each case, the CLI writes the files into <code>force-app<\/code> in source format.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Deleting Metadata with Salesforce CLI Deploy<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes a release must remove things, such as an old class nobody uses. Change sets cannot do this. The CLI, however, can delete metadata safely.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For one or two items, use the delete command. It removes the item from the org and from your local files.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sf project delete source --metadata ApexClass:OldCourseHelper --target-org brightpath-uat<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For planned releases, use a destructive manifest instead. You create a file named <code>destructiveChanges.xml<\/code> with the same layout as package.xml. Then you add it to a Salesforce CLI Deploy with the <code>--post-destructive-changes<\/code> flag. As a result, the deploy adds the new items first and removes the old ones after.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Be careful with deletes in production. Always validate first, and keep a backup of the files in Git.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Source Tracking in Scratch Orgs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Scratch orgs and Developer sandboxes can track changes for you. Salesforce calls this feature source tracking. The CLI remembers what you deployed and spots what changed in the org since then.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So in a tracked org, you can run a Salesforce CLI Deploy with no flags at all. The CLI sends only the files you changed. In the same way, a plain <code>sf project retrieve start<\/code> pulls only what changed in Setup.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before you move anything, you can see the list of changes with a preview.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sf project deploy preview\nsf project retrieve preview<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Each command prints a table of items that would move, with no changes made. This is a safe habit before every deploy or retrieve in a tracked org.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Salesforce CLI Deploy vs Change Sets<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Admins often ask how the CLI compares to change sets. The table below shows the main differences.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Feature<\/th><th>Change sets<\/th><th>Salesforce CLI Deploy<\/th><\/tr><\/thead><tbody><tr><td>Works between<\/td><td>Connected orgs only<\/td><td>Any org you can log in to<\/td><\/tr><tr><td>How you build it<\/td><td>Clicks in Setup<\/td><td>Files and commands<\/td><\/tr><tr><td>Version history<\/td><td>None<\/td><td>Full history with Git<\/td><\/tr><tr><td>Delete metadata<\/td><td>No<\/td><td>Yes, with destructive changes<\/td><\/tr><tr><td>Automation<\/td><td>No<\/td><td>Yes, in CI\/CD pipelines<\/td><\/tr><tr><td>Learning effort<\/td><td>Low<\/td><td>Medium<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When to use which depends on your team. Change sets are fine for small admin changes. However, for code and team projects, the CLI is the better choice.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-2-1024x640.png\" alt=\"Salesforce CLI Deploy diagram comparing change sets and the CLI\" class=\"wp-image-1195\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-2-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-2-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-2-768x480.png 768w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-2-1536x960.png 1536w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-diagram-2-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Change sets vs Salesforce CLI deploy.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">A Real Salesforce CLI Deploy Example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s run a full Salesforce CLI Deploy for the Bright Path Tutors course feature, from a sandbox to production.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Retrieve the latest Course object from the sandbox, so your files include any admin changes.<\/li>\n\n<li>Run <code>sf project generate manifest --source-dir force-app --output-dir manifest<\/code> to build package.xml.<\/li>\n\n<li>Validate the release against production with RunLocalTests.<\/li>\n\n<li>Read the result and fix any failed tests or errors.<\/li>\n\n<li>Quick deploy with the job ID during your release window.<\/li>\n\n<li>Retrieve once more from production to confirm the files match.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">If a Salesforce CLI Deploy fails, the terminal shows a table of errors. Each row names the item and the problem. Here is a typical example.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Component Failures [1]\nType       Name           Problem\nApexClass  CourseService  Variable does not exist: Fee (12:20)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This tells you the file, the line and the column of the problem. In this case, the code used <code>Fee<\/code> instead of <code>Fee__c<\/code> on line 12. So you fix the name and deploy again.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes with Salesforce CLI Deploy<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Deploying to the wrong org. Always check the target alias before you press Enter.<\/li>\n\n<li>Not retrieving first. You may overwrite a change an admin made in Setup.<\/li>\n\n<li>Forgetting tests in production. Plan your test classes before the release day.<\/li>\n\n<li>Leaving out dependencies. A field must exist before a class that uses it can compile.<\/li>\n\n<li>Using NoTestRun in production. Salesforce does not allow it when your deploy has Apex.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for Salesforce CLI Deploy<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Validate production releases early, then quick deploy during a short window.<\/li>\n\n<li>Keep package.xml in Git, so every release has a clear list.<\/li>\n\n<li>Use RunSpecifiedTests for small releases to save time, but keep good coverage.<\/li>\n\n<li>Retrieve before you deploy, so your files match the latest org state.<\/li>\n\n<li>Add <code>--wait 30<\/code> on long deploys, so the command waits up to 30 minutes for the result.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practice Task<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create a package.xml with your CourseService class and Course object. Validate it against a scratch org or sandbox, then run a quick deploy with the job ID. Hint: use <code>sf project deploy report<\/code> if you lose the job ID.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.sfdx_cli_reference.meta\/sfdx_cli_reference\/cli_reference_project_commands_unified.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Salesforce CLI Command Reference: project deploy<\/a><\/li>\n\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.sfdx_dev.meta\/sfdx_dev\/sfdx_dev_develop_any_org.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Deploy and Retrieve in the Salesforce DX Developer Guide<\/a><\/li>\n\n<li><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/projects\/quick-start-salesforce-dx\" target=\"_blank\" rel=\"noopener noreferrer\">Trailhead: Salesforce DX quick start<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Deploy sends metadata files to an org, and retrieve pulls them back.<\/li>\n\n<li>Choose what to move with <code>--source-dir<\/code>, <code>--metadata<\/code> or <code>--manifest<\/code>.<\/li>\n\n<li>A Salesforce CLI Deploy to production needs tests and 75% coverage.<\/li>\n\n<li>Validate first, then quick deploy within 10 days.<\/li>\n\n<li>Retrieve before you deploy, so you never overwrite admin changes.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we look at a handy browser tool for quick tests and logs. Read our <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-developer-console-guide\/\">Salesforce Developer Console guide<\/a> to learn its logs, query editor and anonymous Apex window.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Salesforce CLI Deploy and retrieve commands are how developers move metadata between their computer and their orgs. Deploy sends your files up to an&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1193,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[8,96],"tags":[15,33,7,100,97],"swapz_series":[],"class_list":["post-1196","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce","category-salesforce-developer","tag-beginner","tag-deployment","tag-salesforce","tag-salesforce-cli","tag-salesforce-developer"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Salesforce CLI Deploy and Retrieve Step by Step<\/title>\n<meta name=\"description\" content=\"Salesforce CLI Deploy and retrieve explained: move metadata with source-dir, metadata and package.xml, run tests, validate and quick deploy.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Salesforce CLI Deploy and Retrieve Step by Step\" \/>\n<meta property=\"og:description\" content=\"Salesforce CLI Deploy and retrieve explained: move metadata with source-dir, metadata and package.xml, run tests, validate and quick deploy.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/\" \/>\n<meta property=\"og:site_name\" content=\"Swapnil Zambare - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-02T03:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Swapnil Zambare\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Swapnil Zambare\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/\"},\"author\":{\"name\":\"Swapnil Zambare\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/922ac0131aaa7088c78c2cb1700e0c9a\"},\"headline\":\"Salesforce CLI Deploy and Retrieve: Move Metadata Step by Step\",\"datePublished\":\"2026-09-02T03:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/\"},\"wordCount\":1603,\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/salesforce-cli-deploy-retrieve-metadata-featured.png\",\"keywords\":[\"Beginner\",\"Deployment\",\"Salesforce\",\"Salesforce CLI\",\"Salesforce Developer\"],\"articleSection\":[\"Salesforce\",\"Salesforce Developer\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/\",\"name\":\"Salesforce CLI Deploy and Retrieve Step by Step\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/salesforce-cli-deploy-retrieve-metadata-featured.png\",\"datePublished\":\"2026-09-02T03:30:00+00:00\",\"description\":\"Salesforce CLI Deploy and retrieve explained: move metadata with source-dir, metadata and package.xml, run tests, validate and quick deploy.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/#primaryimage\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/salesforce-cli-deploy-retrieve-metadata-featured.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/salesforce-cli-deploy-retrieve-metadata-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Salesforce CLI Deploy featured image: title card showing files moving to the cloud\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/salesforce-cli-deploy-retrieve-metadata\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Salesforce CLI Deploy and Retrieve: Move Metadata Step by Step\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"name\":\"Swapnil Zambare - Blog\",\"description\":\"Salesforce &amp; Tech Guides\",\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\",\"name\":\"Swapnil Zambare - Blog\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"width\":512,\"height\":512,\"caption\":\"Swapnil Zambare - Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/theSwapnilZambare\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/922ac0131aaa7088c78c2cb1700e0c9a\",\"name\":\"Swapnil Zambare\",\"sameAs\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\"],\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/author\\\/swapnil-zambare\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Salesforce CLI Deploy and Retrieve Step by Step","description":"Salesforce CLI Deploy and retrieve explained: move metadata with source-dir, metadata and package.xml, run tests, validate and quick deploy.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/","og_locale":"en_US","og_type":"article","og_title":"Salesforce CLI Deploy and Retrieve Step by Step","og_description":"Salesforce CLI Deploy and retrieve explained: move metadata with source-dir, metadata and package.xml, run tests, validate and quick deploy.","og_url":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/","og_site_name":"Swapnil Zambare - Blog","article_published_time":"2026-09-02T03:30:00+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-featured.png","type":"image\/png"}],"author":"Swapnil Zambare","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Swapnil Zambare","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/#article","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/"},"author":{"name":"Swapnil Zambare","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/922ac0131aaa7088c78c2cb1700e0c9a"},"headline":"Salesforce CLI Deploy and Retrieve: Move Metadata Step by Step","datePublished":"2026-09-02T03:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/"},"wordCount":1603,"publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-featured.png","keywords":["Beginner","Deployment","Salesforce","Salesforce CLI","Salesforce Developer"],"articleSection":["Salesforce","Salesforce Developer"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/","url":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/","name":"Salesforce CLI Deploy and Retrieve Step by Step","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/#primaryimage"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-featured.png","datePublished":"2026-09-02T03:30:00+00:00","description":"Salesforce CLI Deploy and retrieve explained: move metadata with source-dir, metadata and package.xml, run tests, validate and quick deploy.","breadcrumb":{"@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/#primaryimage","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-featured.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/salesforce-cli-deploy-retrieve-metadata-featured.png","width":2400,"height":1260,"caption":"Salesforce CLI Deploy featured image: title card showing files moving to the cloud"},{"@type":"BreadcrumbList","@id":"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-deploy-retrieve-metadata\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/swapnilzambare.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Salesforce CLI Deploy and Retrieve: Move Metadata Step by Step"}]},{"@type":"WebSite","@id":"https:\/\/swapnilzambare.com\/blog\/#website","url":"https:\/\/swapnilzambare.com\/blog\/","name":"Swapnil Zambare - Blog","description":"Salesforce &amp; Tech Guides","publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/swapnilzambare.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/swapnilzambare.com\/blog\/#organization","name":"Swapnil Zambare - Blog","url":"https:\/\/swapnilzambare.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","width":512,"height":512,"caption":"Swapnil Zambare - Blog"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/in\/theSwapnilZambare"]},{"@type":"Person","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/922ac0131aaa7088c78c2cb1700e0c9a","name":"Swapnil Zambare","sameAs":["https:\/\/swapnilzambare.com\/blog"],"url":"https:\/\/swapnilzambare.com\/blog\/author\/swapnil-zambare\/"}]}},"_links":{"self":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/comments?post=1196"}],"version-history":[{"count":0,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1196\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media\/1193"}],"wp:attachment":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media?parent=1196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/categories?post=1196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/tags?post=1196"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=1196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}