1

i have the metadata's pushed into a git repo, after making changes and tested in my individual sandbox. While trying to deploy to the higher env, i am trying to get a package.xml generated by itself, based on the files that have changed.

Have anyone done this?

3 Answers 3

5

there is this awesome tool on github https://github.com/amtrack/force-dev-tool

You can use following command to create a changeset:

$ git diff master feature/vat | force-dev-tool changeset create vat
2
  • i seriously think this is what i am looking for. Espicially the cool feature of generating the package.xml via the git diff. I will test it out further and will let you know.
    – OK999
    Jul 14, 2017 at 19:24
  • As force-dev-tool is deprecated now in favor of Salesforce DX, does anybody know how to generate package XML from git diff using sfdx? Is it even possible?
    – Łukasz K
    Mar 25, 2020 at 12:02
2

As force-dev-tool is deprecated, here is a solution (by the author of the tool - Matthias Rolke) using Salesforce DX:

deployDir="$(mktemp -d)"
git diff --name-only --pretty="" develop feature/myfeature | paste -d, -s - | xargs -0 sfdx force:source:convert -d "${deployDir}" -p

(Please note that it doesn't handle destructive changes).

1
  • Any advice for if you receive the error xargs: argument line too long?
    – nbrown
    Sep 30, 2022 at 18:12
1

There are (paid) tools that can do this, such as GearSet (standard disclaimer: I am not affiliated with or endorse this product), which you can find both on the AppExchange and using Google searches. You can also build a Package, include it as part of your source control, and use that package to deploy projects. You could also automatically generate a package.xml file using force:manifest:create from Salesforce DX. You'll want to look at the documentation for more details. Generally speaking, it's still acceptable to deploy all components, however, as it generally just takes longer to deploy in the worse case scenario.

2
  • Apart from the gain in deployment time, are there any down-side in deploying only changed files/components? i can think of a dev missing out something in the package.xml , that have been changed. In case, we are going to construct/merge the package.xml 's
    – OK999
    Jul 14, 2017 at 17:07
  • @OK999 Using an unmanaged package builds the package.xml for you when you retrieve it. It also validates that no components are missing. That said, it does generate a full deployment. A diff deployment is definitely faster. You may even want to combine the two to make sure you don't miss anything.
    – sfdcfox
    Jul 14, 2017 at 18:22

You must log in to answer this question.

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