We have previous deployments that took place in our Salesforce production org and we are now in transition to keep our metadata config changes in Git repos. I'm wondering if there is any easy way of converting the Previous changesets to package.xml so that i can retrieve it from org and store it in our repos. I have to manually look at each component and create the metadata package which is very time consuming and certainly not a convenient way-

I couldn't find any solution. Please help!!

1 Answer 1


The new project retrieve start command allows you to retrieve change sets as if they were packages.

For source format, use:

sf project retrieve start -n "My Change Set Name"

And for MDAPI format, use:

sf project retrieve start -n "My Change Set Name -t "src"

Original Answer

You can retrieve them as if they were packages. This is as simple as:

sfdx force:source:retrieve -n "My Change Set Name"


sfdx force:mdapi:retrieve -r "outputDir" -p "My Change Set Name"

Depending on if you want Source or MDAPI format.

Note that the Source format is recommended if you want to later create Unlocked Packages for easier deployments to disparate orgs, including Scratch Orgs.

  • 1
    To use newer sf commands, use 'sf project retrieve start -n "My Change Set Name" '. "The project deploy start command works with source and metadata format files. The default is source format. To deploy metadata format files, use the --metadata-dir flag."
    – MikeA
    Nov 13, 2023 at 15:46
  • 1
    @MikeA Thanks for the comment! It's hard to keep track of the 13k+ answers I have when things become outdated. It's important to try and keep our network up to date.
    – sfdcfox
    Nov 13, 2023 at 15:59
  • 1
    @MikeA Note that this question is about retrieval, so it's -t or --target-metadata-dir. The --metadata-dir is for project deploy start.
    – sfdcfox
    Nov 13, 2023 at 16:04

You must log in to answer this question.

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