August 23

Diff Packages

A diff package is a variant of 'source package' , where the contents of the package only contain the components that are changed. This package is generated by sfpowerscripts by computing a git diff of the current commit id against a baseline set in the Dev Hub Org
A diff package mimics a Change Set model, where only changes are contained in the artifact. As such, this package is always an incremental package. It only deploys the changes incrementally compared to baseline and applied to the target org. Unless both previous version and the current version have the exact same components, a diff package can never be rolled back, as the impact on the org is unpredictable. It is always recommended to roll forward a diff package by fixing or creating a necessary change that counters the impact that you want on the target orgs.
Diff packages should never be used with scratch orgs. It should be used with sandboxes only.
A diff package is the least consistent package among the various package types available within sfpowerscripts, and should only be used for transitioning to a modular development model as prescribed by DX@Scale
The below example demonstrates a sfdx-project.json where the package unpackaged is a diff package. You can mark a diff package with the type 'diff'. All other attributes applicable to source packages are applicable for diff packages.
// sfdx-project.json
"packageDirectories": [
"path": "util",
"default": false,
"package": "Expense-Manager-Util",
"versionName": "Winter ‘24",
"versionDescription": "Welcome to Winter 2024 Release of Expense Manager Util Package",
"versionNumber": "4.7.0.NEXT"
"path": "exp-core",
"default": false,
"package": "ExpenseManager",
"versionName": "v 3.2",
"versionDescription": "Winter 2024 Release",
"versionNumber": "3.2.0.NEXT",
"dependencies": [
"package": "ExpenseManager-Util",
"versionNumber": "4.7.0.LATEST"
"package": "TriggerFramework",
"versionNumber": "1.7.0.LATEST"
"package": "External Apex Library -"
"path": "unpackaged",
"default": true,
"package": "unpackaged",
"versionName": "v3.2",
"sourceApiVersion": "58.0",
"packageAliases": {
"TriggerFramework": "0HoB00000004RFpLAM",
"Expense Manager - Util": "0HoB00000004CFpKAM",
"External Apex [email protected]": "04tB0000000IB1EIAW",
"Expense Manager": "0HoB00000004CFuKAM"
A manual entry in sfpowerscripts_Artifact2__c custom object should be made with the name of the package and the baseline commit id and version. Subsequent deployments will automatically reset the baseline when the package gets deployed to Dev Hub