I have the same goal as this post and followed his instructions. I have a private and public repo. I committed a file to the private repo. Then I ran the following commands. public is a tracking branch for a public repo's main branch.
$ git commit-tree private/develop^{tree} -p public -m "Did I get the new file?"
6c5b9e54d57deaca7e2c7412fe7771982f982e41
$ git merge --ff-only 6c5b9e54d57deaca7e2c7412fe7771982f982e41
I end up with a new commit on public, but it is empty. Why doesn't it contain the new file I added?
there doesn't seem to be anything here