I have implemented deployment pipeline in Jenkins using SFDX CLI and GitHub.

I am able to deploy metadata to Salesforce Org using below commands.

  1. First, validate the deployment

    sfdx force:mdapi:deploy -u ${USERNAME} -c -d src -w 10 --soapdeploy

  2. If validation is successful, below step will be executed.

    sfdx force:mdapi:deploy -u ${USERNAME} -d src -w 10 --soapdeploy

My query is whether salesforce deployment using metadata is incremental or not ?

For example, if in first deployment my metadata has class A and in second instance of deployment has Class A and Class B then will second deployment will re-deploy class A or it will only deploy Class B ?

Or whether I need to use some other options like git diff to identify changes and then generate metadata to delpoy ?

  • Do you have a reason to be using mdapi format? Also, is there a reason to be using deploy instead of push (which has automated tracking and thus incremental updates)?
    – Phil W
    Jul 4, 2022 at 14:27
  • No specific reason or requirement to use mdapi format, I am new to Salesforce deployment. I am aware about push option but not sure whether it is available across environment like DEV, QA, UAT & PROD. Will surely check on it. Jul 4, 2022 at 17:08
  • 1
    Prod is special and limits just what you can do across the board in terms of deploying to it. Other orgs can have source tracking enabled. That said, consider using scratch orgs instead of dev orgs for development.
    – Phil W
    Jul 5, 2022 at 5:52

2 Answers 2


sfdx force:mdapi:deploy is not incremental. Whatever is in the deploy directory (and the package.xml, which is required and must specify everything in the deploy directory) is deployed.

It is technically possible to use the information from git diff to build a more incremental deploy directory, but working through the results of a diff is a non-trivial task. The sfdx git delta plugin (I have no affiliation with that) can help with that so you don't need to roll your own solution.

It's also only incremental to the artifact level. I.e. any change to a class means the entire class is getting deployed. Though I suppose that's true for Salesforce in general.

All said and done, it can work but I believe that the CI/CD pipeline friendliness hierarchy goes like this:

  1. 2GP packages (most friendly)
  2. sfdx force:source:deploy
  3. sfdx force:mdapi:deploy (least friendly, excluding making a Changeset via the web UI)

It will deploy eveything from the src folder and it is not a delta deploy.

Delta deploy is not something that CLI supports out of box. However you can find some open source projects that provides this feature.

One such tool is sfdx-git-delta. Learn more about it in the repo below https://github.com/scolladon/sfdx-git-delta

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .