Does magit have a feature to overcome this?
Magit doesn't have a feature along the lines of what you describe.
I'd recommend that you not store the private and public commits on the same branch. Switch to the public branch to make public commits, then sync those changesthat branch with another branch that has the private branchcommits. Depending on your tastes, you could do that beby either (1) rebasing the private branch on top of the public or (2) merging the public into the private branch.