In Salesforce DX, I read through the document but it seems to me I can only use sfdx:force:source:push or pull to push or pull all the files. Or use .forceignore to ignore some files.

However, is that possible for me to just sync one file and ignore all the others?

  • How do you incision that working when to whole point of DX is that all the files are in sync ? I guess what is the use case here since it seems completely against the point of sfdx.
    – Eric
    Commented Feb 1, 2018 at 5:29
  • Disagree with Eric. Since SF reformats XML, you often have issues where profiles are showing as out of sync, and you have to do a --forceoverwrite pushing the whole org just to correct one file.
    – Shanerk
    Commented May 27, 2020 at 14:26

2 Answers 2


Looks like this should be an idea under idea exchange for the salesforce DX Product team. Currently don't think you can push one file and there are no commands supporting this. Salesforce DX is just not designed that way at this point although sounds like having a local staging like git to add and commit makes sense.


You can now use sfdx force:source:deploy command to push one file. However, the key thing to note here these commands won't have source tracking built into them.


Yes. Use the deploy command to push:

sfdx force:source:deploy -p "/PATH/TO/YOUR/COMPONENT"

Use the retrieve command to pull:

sfdx force:source:retrieve -p "/PATH/TO/YOUR/COMPONENT"

If the component doesn't exist on your local you have to get it via metadata, for example:

sfdx force:source:retrieve -m "ApexClass:YOURAPEXCLASS"

Note the name of the metadata is the API Name, not the filename. To get all files of a certain metadata type:

sfdx force:source:retrieve -m LightningComponentBundle

Although surrounding your path or metadata name with quotes is optional, you will have to include them if you have any spaces in the names.

  • this works great for individual files without having to mess with package.xml! But like @mohith pointed out, this will result in your source tracking being out of sync
    – TimmyG
    Commented Nov 12, 2020 at 17:49
  • @TimmyG that is true, but the OP didn't specify they were only concerned with orgs that have source tracking. It would be nice if SF had a way to flag deploy commands to also update source tracking. Note that push does not work with orgs which do not have source tracking, but deploy works for both types of orgs.
    – Shanerk
    Commented Nov 12, 2020 at 21:06
  • how to deploy multiple components
    – JPM
    Commented Feb 24, 2023 at 11:44
  • sfdx force:source:deploy -p ""/PATH/TO/YOUR/COMPONENT1", "/PATH/TO/YOUR/COMPONENT2""
    – Shanerk
    Commented Feb 25, 2023 at 17:23

You must log in to answer this question.

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