Auxiliary repository clean up tasks
Remove unneeded generated files
Sometimes you may commit files to source control that don't (or no longer) need tracking. This may include: - Files generated by Salesforce on feature activation (such as Community/Experience Cloud classes) accidentally added on first initialisation/through a feature branch. - Overrides of Salesforce classes/files that no longer need patching
Removing them through the standard process will mean they are included in destructiveChanges.xml and will be removed from your target on deployment, which in this case is not what you want to do. There is just one extra step to resolve this problem.
- Follow the standard process (hardis:work:new) to delete your files, remove them from package.xml and call hardis:work:save to create your PR
- Manually update destructiveChanges.xml to remove the references to the files you do not want to delete from your target org
- Commit this change
- Manually push to your branch (do not use hardis:work:save)
- Merge your PR