Moving from a private GitHub replica to a public and private one

I developed a client project using a private repo on GitHub. Now we want to open a specific part and create an open source version of the project. The idea is that the client version will build on this. Any changes made to the open source version must also go to private.

Now the problem is that I can't just install the current GitHub repo for everyone. There are certain pieces of code that should remain accessible only to the client. So to the actual set of questions:

  • Is it possible to set up a couple of GitHub repos so that the parent is public while the fork remains private?
  • Is it possible to completely remove some files and their history from the repo? (If possible 1., I could just add them there again.)

I guess I could start the repo from scratch and then work on top of that, but in that case, I would lose valuable history.

Any ideas are appreciated. If necessary, I can provide you with more detailed information.


source to share

2 answers

You can try to split the project in two and then use git submodule

to connect them.

A parent project that is private can contain a public project for a submodule.

See for details .



Regarding the second part of your question:

You can use git filter-branch to remove files or entire directories from your history.

Also see the question: How to remove sensitive files from git history .



All Articles