A research group I'm participating in currently hosts all of their code in a private SVN repository. We'd like to open up our code and move most of it onto Github. The problem is, some of the code is sensitive and should not be opened up, but we still want it under version control. At the moment, we have the open code on Github and the private code still in the private SVN repository. Is there a good way to do this in a single Git repository?
With a single git repository, no. What you can do is use git submodules, which allow you to "combine" repositories. Keep your public code on github, create another, privately hosted, git repository for your private code which references the public code as a submodule. Changes made within the public submodule can be pushed up to github, and changes on github can be pulled back down, but changes outside the submodule won't be exposed to the public community. Although the code trees will be merged into a single root you will have to manage commits, pushes, and pulls independently between the separate modules, which many people find cumbersome and problematic, so you should do some experimentation with the workflow before distributing widely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With