How to treat a meta-repository of git repositories?

git

Solution

The 'meta' tool is fantastic for this.

You can find it on npm: https://www.npmjs.com/package/meta

You can use it to clone a meta-repo and all sub-repos at once which is great.

You then use it to apply operations to all your sub-repos, eg to pull your meta-repo and all sub-repos:

cd my-repo
meta git pull

There's an article here with help to get started and use 'meta': https://medium.com/@patrickleet/mono-repo-or-multi-repo-why-choose-one-when-you-can-have-both-e9c77bd0c668

Problem

Given a tree of git repositories in a project directory, e.g. ``` Projects/ +A/ |+.git/ +B/ |+.git ``` I'd like to set up a git repository `Projects.git` that does not track the project's contents but only their existence and status. Someone cloning this repository should only have a sekeleton of uncloned repositories `A`, `B` etc. and individually activate whether they are kept in sync or not. A typical workflow would look like this: - First time setup: `git clone server:Projects.git` - Activate project `A`, which also clones it - Now every `git-push/pull`, independently of whether it's in `Projects/` or `Projects/A` should update both `A.git` and `Projects.git`'s information about `A`. Anything related to `B` should be ignored since it's inactive and locally empty - Activate project `B`, cloning that as well - Now any `git-push/pull` in `Projects` should also do so in both `A` and `B`, while a push/pull in `A` should not influence `B` - Deactivate project `A`, which (after verifying `A.git` doesn't need a `git-push`) empties the local directory `A`, with no influence on `Project.git` How can this be treated best? My current approach would be some hook-magic, but I'm not familiar enough with git submodules to see whether this could be achieved with submodules or whether I need to use some other solution.

Original source

Related problems