We have an existing salesforce 2GP package that follow the default directory layout with components in main/default. I would like to break that up into feature folders, but I am not able to move files for existing components and push that. When I move a file, sfdx source tracking sees that as two operations: a delete and an add operation, so it complains that it "Cannot delete managed object". Files for objects that have not yet been published can be moved around freely.

Is there some way to rearrange the file layout of the files in a previously published package?

Please excuse me, if my terminology is inaccurate: I am new in Salesforce land and have inherited this package developed by others.

Thanks, Morten

1 Answer 1


You should be able to clear your tracking files, which will be fixed by the SFDX CLI the next time you perform a push or deploy.

sfdx force:source:tracking:clear

In this manner, nothing will be considered a deletion, because all tracking is deleted.

  • Seems to work despite the big warning the command issues. Everything ended up as a conflict afterwards but with --forceoverwrite I could push. Seems to solve the issue, thanks! May 3, 2022 at 9:10

You must log in to answer this question.

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