I have been using a command from the old CLI: sfdx force:source:deploy -p "/path/to/filename.cls" to deploy by filename.

Is this possible using the new CLI?

I do see an example of sf project deploy start --source-dir path/to/apex/classes/MyClass.cls path/to/source/objects in the help, but I'm not sure if this is what I am looking for because it has a second parameter added.

Or do I have to deploy by metadata?

  • Did you even try to do it? Yes it is correct command Feb 6 at 15:08
  • @user1974566 Why does it have a path added to the parameter? I didn't pass a path before. I didn't try it before I understand what is the difference
    – Z0q
    Feb 6 at 15:13
  • Why is this downvoted?
    – Z0q
    Feb 9 at 9:46

2 Answers 2


If you look further down in the documentation on sf project deploy start, it'll go over the individual flags in more detail.

Directly quoting that documentation:

-d | --source-dir SOURCE-DIR

Path to the local source files to deploy.

The supplied path can be to a single file (in which case the operation is applied to only one file) or to a folder (in which case the operation is applied to all metadata types in the directory and its subdirectories).

If you specify this flag, don’t specify --metadata or --manifest.

So yes, that's what you're looking for. The example shows deploying a single file from one folder in addition to everything in a different folder.

sf project deploy start -d /path/to/filename.cls ought to work
that said
sf project deploy start -m ApexClass:ClassName is probably going to be less typing, and would achieve the same result.

  • Small typo, the last line should be ApexClass:ClassName and not ApexClass:filename (which implies the .cls should be included).
    – sfdcfox
    Feb 6 at 15:48
  • @sfdcfox fixed!
    – Derek F
    Feb 6 at 15:50

Yes, the project deploy start command is the approximately equivalent command as force:source:deploy. See the force:source:deploy documentation for the list of differences between the two commands. -p, --sourcepath has been renamed to -d, --source-dir, as shown in the migration table.

You must log in to answer this question.

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