Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to structure dependent projects on github?

I recently put some of my projects on github to make them open source but I'm having trouble understanding how to structure the projects properly.

I've got a Core project and another project that depends on the Core project (plus more to come). However, when users grab a copy of one of the projects they complain that it's missing the Core project and I have to tell them that it lives in a separate repository.

I know there must be a better way to do this. I've read about git submodules but I don't really understand them yet.

My question is, are there any easy to follow tutorials or examples of how I can structure my projects? I'm using Windows, TortoiseGit and my projects are in C#.

like image 872
craftworkgames Avatar asked Jun 18 '13 04:06

craftworkgames


People also ask

How do I use dependencies on GitHub?

Under your repository name, click Settings. In the "Security" section of the sidebar, click Code security and analysis. Read the message about granting GitHub read-only access to the repository data to enable the dependency graph, then next to "Dependency Graph", click Enable.

What are GitHub dependencies?

GitHub's dependency graph identifies all upstream dependencies and public downstream dependents of a repository or package by parsing manifest files, so that you can better manage the security and compliance of your dependencies.


2 Answers

You can use subtrees or submodules. http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/

like image 110
CodeWizard Avatar answered Nov 08 '22 04:11

CodeWizard


Instead of providing the source code for your dependencies, it may be better to use dependency management instead. This allows your projects to be built individually and also provides proper dependency versioning. This also means that your users do not need to worry about dependencies.

Microsoft's package manager for .NET - NuGet - is integrated into every version of Visual Studio nowadays. You can also try Paket as an alternative.


To package your project, you'd first add a package spec to your project. You then build a .nupkg file and upload it to NuGet.org to make it available to other projects. Check Microsoft's documentation for details.

In your main project, remove your dependency and use "Manage NuGet Package..." to add your own package as a dependency instead.

like image 25
diredev Avatar answered Nov 08 '22 06:11

diredev