I had created a number of packages and package versions in order to help prepare for moving our metadata to packages in production. At some point, I accidentally pulled in a bunch of metadata that I did not intend to include in the package, and then I ran a script to remove those extra files, and ended up deleting more than I meant to.
I can't roll back to my last commit, because it won't have all the files, so creating a new version will cause metadata to be removed that I don't want removed. So, ultimately, what I'm looking for is a way to recover the metadata in the last version of my Unlocked Package. I already tried retrieving the package using force:source:retrieve with a package name, but I got an error saying the package doesn't exist.
Is there any way to retrieve the metadata from the package version so I can reset my repo back to the last good version that I had created?
git checkout --patch
will allow you to checkout your files and choose whether to discard or keep your local changes you haven't committed yet. Could keep what you want and discard the accidental deletions. Likewise, some combo ofgit stash
and reverting back to your original commit might work in your favor hereforce:package:install -p 04t...
to push that specific package version with the contents you need into an empty org and then retrieve all of the metadata from the new org.