Reputation: 693
Im new at git and i don't have idea to do that.
Im building a template, which have a module pack and the module pack contains modules.
The modules can be instalated for separate and can have multiple versions of the same module (pro, simple..). (I think i can do branch in my module folder).
The pack of modules can instaled without template but need to have modules inside with the last version of they and this pack modules can have a version too, for example version one include module 1,2,3 ...
And finaly i have the template which have files too and the package of modules which have to had the last version of them.
In resume, i need to controll versions of all together and separate, but i have to had all of them in the same place
I think I could do this
-- Template (git folder)
-- Module pack (git folder)
-- Module 1 (git folder)
-- Pro version (branch)
-- Simple version (branch)
-- Module 2 (git folder)
-- ....
Is this posible or I should think in other methods ? Thank you.
Upvotes: 2
Views: 517
Reputation: 3559
I just have a solution for your problem - gil (git links) tool
It allows to describe and manage complex git repositories dependencies.
Also it provides a solution to the git recursive submodules dependency problem.
Consider you have the following project dependencies: sample git repository dependency graph
Then you can define .gitlinks
file with repositories relation description:
# Projects
CppBenchmark CppBenchmark https://github.com/chronoxor/CppBenchmark.git master
CppCommon CppCommon https://github.com/chronoxor/CppCommon.git master
CppLogging CppLogging https://github.com/chronoxor/CppLogging.git master
# Modules
Catch2 modules/Catch2 https://github.com/catchorg/Catch2.git master
cpp-optparse modules/cpp-optparse https://github.com/weisslj/cpp-optparse.git master
fmt modules/fmt https://github.com/fmtlib/fmt.git master
HdrHistogram modules/HdrHistogram https://github.com/HdrHistogram/HdrHistogram_c.git master
zlib modules/zlib https://github.com/madler/zlib.git master
# Scripts
build scripts/build https://github.com/chronoxor/CppBuildScripts.git master
cmake scripts/cmake https://github.com/chronoxor/CppCMakeScripts.git master
Each line describe git link in the following format:
Empty line or line started with # are not parsed (treated as comment).
Finally you have to update your root sample repository:
# Clone and link all git links dependencies from .gitlinks file
gil clone
gil link
# The same result with a single command
gil update
As the result you'll clone all required projects and link them to each other in a proper way.
If you want to commit all changes in some repository with all changes in child linked repositories you can do it with a single command:
gil commit -a -m "Some big update"
Pull, push commands works in a similar way:
gil pull
gil push
Gil (git links) tool supports the following commands:
usage: gil command arguments
Supported commands:
help - show this help
context - command will show the current git link context of the current directory
clone - clone all repositories that are missed in the current context
link - link all repositories that are missed in the current context
update - clone and link in a single operation
pull - pull all repositories in the current directory
push - push all repositories in the current directory
commit - commit all repositories in the current directory
More about git recursive submodules dependency problem.
Upvotes: 4