hikaru
hikaru

Reputation: 2564

Two git repos coexisting - not possible, or how?

We have an enterprise application, and we use git for scm. Additionally, the foundation of this project is our open source tool, a public git repo.

If you are an enterprise customer, the install process a) installs the open source tool and b) installs the enterprise features on top of the open source tool in the same directory structure.

For deployments this is just fine. For development it's a nightmare.

Is there any way to have the two complex, overlapping projects in the same structure? I don't see how but thought I'd ask.

Right now I have it set up this way:

Here's the problem, before I can commit open source repo changes, I have to "uninstall" enterprise so I can see changes clearly. (Or manage a .gitignore with hundreds of entries) What a pain.

Big projects too... 25+ modules, and over a hundred files that get copied in with enterprise edition. Many packages even have extra modules in enterprise.

Any ideas, or have I done it as good as it can be?

Upvotes: 1

Views: 117

Answers (2)

Steven
Steven

Reputation: 2275

Another thing you can do is adding the open source project to your git project as a sepparate branch.

The open source git repository of the open source project will then manifest itselves in your git project as a set of branches. You can then combine it in your project by merging it in.

As git is a distributed version system, this is rather easy to do:

#Add the open source repo as a remote
git remote add -f open_source_git <url to open source git repo>
#Create a local branch to track the remote branch
git branch open_source_master open_source:master
# Combine the two projects
git merge open_source_master

The open_source_master branch is there so you can easily update and keep track of the open source repo from withing your own repository.

Upvotes: 0

zanegray
zanegray

Reputation: 768

Git Submodules allow you to keep disjoint git projects, yet use one within another. It may be handy in your case because you can modify the open source tool all you want while keeping the enterprise version pointed to a specific version of the open source tool. When you want to upgrade the enterprise to a newer commit, that's easy too!

Here is a good resource.

Upvotes: 3

Related Questions