0

I am developing an application that has some features which are only meant to be available to members of the company while the majority of the application is for public use.

Having two separate repositories is a nightmare, since many bugs, feature requests etc. related to one are relevant to the other. Is there any good way to handle this with repositories?

Currently, I just have 2 separate repositories, and whenever one is changed I have to go and make the corresponding changes in the other repository. And simply copying over files doesn't always work, since the internals of some of the main scripts are slightly different.

0

3 Answers 3

2

Since you are using git, there is nothing preventing you from merging changes. What you really have is an internal and external fork. Even if there repositories started out with completely different history as long as the file structure is the same you can combine the two histories. The first merge will be kind of painful, but things should go much smoother after that.

The key here is that each repository should have the same file structure. The only differences should be the code and/or files that are different between the two forks.

0

This is what configuration is for. Simply add an environment variable or other configuration variable that is set on the deployment of the code. Something like:

FEATURE_SET=internal

The code looks for the environment variable and not found defaults to a value. Then only one repository is required.

3
  • So the code is not compiled. It is a set of scientific scripts and workflows. The application also ships with data. The private version has some additional private data as well. So there are explicit sections that shouldn't be able to even be seen by the public version. Commented Nov 13, 2019 at 17:30
  • 1
    Ahhh, you could still potentially signal sections of code to be internal/external, but you would have to have a pre-porcessor to go through all your scripts and strip out the internal parts and data. Doable, but more complex.
    – Jon Raynor
    Commented Nov 13, 2019 at 17:33
  • Yes, that sounds like the automated version of what I'm doing now :p. Ideally, I was hoping there would be a way to somehow link them via version-control. Something akin to a psuedo-merge of the two repositories would make things much easier Commented Nov 13, 2019 at 17:35
0

Have you considered creating a third repository which contains all the "shared" code, which is then used as a library by the other two?

5
  • While this would remove the presence of some redundant code, I think it would add overhead for the users to install, as well as causing some users to potentially report bugs/feature requests on the wrong repository. It also wouldnt be robust to changes to the shared repo that only should be used by the private version. There are definitely advantages to this, but it's probably not worth transitioning both codebases to an entirely new structure. Commented Nov 13, 2019 at 17:59
  • @BryceKille ok, but if you would have the common base as explained here, and have the two others as a sync fork ? (help.github.com/en/github/…)
    – Christophe
    Commented Nov 13, 2019 at 19:40
  • @BryceKille Fair enough on your first two points, however for the third, I think you've misunderstood slightly. Anything that's only used by the private version would stay in your existing private repo. The shared repo is only for things that are in both public AND private.
    – Pete
    Commented Nov 14, 2019 at 9:43
  • Yes that is how I understood it. However, my point is if we want to add any private functionality to a module in the “shared” repo, we would have to remove it from the repo entirely and copy it to the two other repos Commented Nov 14, 2019 at 23:45
  • @BryceKille I'm not sure I understand you. If you have a piece of functionality that is currently only in the "private" system and you want to make it available in both, then you would remove it from "private" and add it to "shared". You wouldn't need to change "public" at all (with the possible exception of some glue code to make it show up in the user interface).
    – Pete
    Commented Nov 15, 2019 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.