Overlapping projects

Am preparing a couple of projects, P1 and P2, to host on GitHub. Both projects are part of a larger project, P, and have source code in common. For this reason, I’d like to host the big project, P, on GitHub, as well as both P1 and P2. On the P1 and P2 pages, I will explain this situation, and I would like the P1 clone url to pull just the P1 source files out of the big P project , and the same for the P2 project. The big P project can have the usual clone url, if that is what someone wants to do – get all the source code for both projects.

So, my question is how to set up the clone urls on the P1 and P2 pages do this?

Welcome to the community, we’re glad you stopped by! :slight_smile:

I’m not certain I’m understanding exactly what it is you’re trying to do, so if you’ll bear with me as I ask for clarification we’ll see what we can do to help. It sounds like what you want is to have three repositories on GitHub:

And if someone clones from https://github.com/normvcr/p, they should get normvcr/p with p1 and p2 inside it?

If I’m understanding correctly, you may be interested in this GitHub Blog post about using submodules:

It describes a situation very similar to what you’re talking about and how you can make it all work.

I hope that helps!

1 Like

Thanks for the pointer to the interesting article on submodules. I don’t think submodules will do it for me, as p1 and p2 share source code in common, and I do not want to duplicate source code – this is why I want to have just one repository,p, with all the source code, and the other projects can do, say, sparse checkout. But, this requires some setup. The p1 project would provide the patterns needed for the p1 sparse checkout, but how to integrate this file of patterns with the clone url that is the current interface for getting hold of p1?

1 Like

There isn’t a way to customize the clone user experience that’s provided by the GitHub UI, it is set up to only clone the entire repository. If you want people to use some other mechanism to clone your repo, you would have to document it in the README (or some other document in the repository) and point people to it that way.

OK, thank you for your feedback and time.

1 Like