How to manage custom package in Git?

I followed the instructions here to create a custom embedded package: Unity - Manual: Creating custom packages.

Once I finished that, in my newly created com.mycompany.mypackage folder, I created a Git repo (to be clear, I’m not using Unity’s built-in source control). When I reloaded the project, my local repo had been automatically deleted by Unity and my package was now contained within PackageCache. This made sense once I read the documentation, but now I’m wondering how to maintain my package in a Git repo if it’s now in a temp directory. If I were to update my package, I would need to re-import it into the test project and my local Git repo would be erased once again.

I also can’t seem to edit custom packages (won’t let me add files to the directories) which also limits the usefulness of this approach

What I need is a project where I can maintain and work on my package, and track all of that in Git. Then I will import the package into separate project for testing purposes.

What is the correct workflow for this? Should I have created a local package instead?

Yes, what I do when I develop a package with source control (so basically always) is I check out the repo in the Packages folder. I develop there, I can submit changes from there. This also means the test scenes and whatnot are handled separately.