Private branch, Public repo

Sorry if this is in the wrong place I was not sure where to put it.
I have a open source project that I wan to make a public repo for. However my company has some private code that we want to keep in a private branch and not open source. Is this possible? Sorry I searched and did not see any answer for this. Thanks for the help!

This is a good case for what I call “branching via clones”.

In such a case, you could PULL from your public repo INTO your private repo clone, and NOT PUSH the private stuff into the public repo clone.

Have you noticed git push and git pull accept a name of the branch to push and pull?

But that’s not something I recommend really. Why not keep the private code in a completely private subrepository,
and use git sub repositories? Internal users could have an “” that fetches your other sub repositories and configures the source code to use the optional parts…