I'd like to open source a bunch of our private code, while still allowing us to work in private, sharing subsets back with the public community, and incorporate community changes back into our private repo. I believe GitHub can do all of this, but am struggling to make it work in practice. Can you help me figure out how to make this work?
I'm reasonably savvy with git/GitHub for basic flows, but I'm out of my depth for this exercise. I've seen a very good overview here, but it leaves much of the detail as an "exercise to the reader" -- and I can't figure it out. Specifically, here's what I've done so far to test (in glorious detail for future reference by others):
Created a new private repo containing nothing but a
README.md
file inExpensify/dbarrett_PrivateTest
(Can't link to it because it's private)Cloned it locally with:
git clone git@github.com:Expensify/dbarrett_PrivateTest.git
Created a new public repo: https://github.com/Expensify/dbarrett_PublicTest
Made a "bare clone" of the private repo locally:
git clone --bare git@github.com:Expensify/dbarrett_PrivateTest.git
Pushed it to the public repo:
cd dbarrett_PrivateTest.git git push --mirror git@github.com:Expensify/dbarrett_PublicTest.git
Pulled down my public repo (which is now joyously populated with the private commits):
git clone git@github.com:Expensify/dbarrett_PublicTest.git
Edited
README.md
in the public repo and pushed the public commit:vim README.md git commit -a git push origin master
Rejoiced as I successfully pushed a public commit to the public repo, just as I'm hoping future open source contributors will.
Replayed the same steps in (7) in my private repo, and successfully pushed a private commit to my private repo (and confirmed it didn't show up in the public repo).
However, that's as far as I've gotten. Here's what I'd like to do next, but can't figure out how:
Pull that public commit down into my private repo, simulating how I would incorporate public contributions into my private codebase.
Push that private commit into the public repo, simulating how I would contribute my own changes back into the community.
I've seen talk of some more advance git concepts than I know how to handle (remotes, fetching, etc), so I'm a bit over my head and can't figure out the next step. Can you make any suggestions? Thanks!