I have a couple of working trees with some dependences. AFAIK, git submodule would enforce the following:
- have a copy of each working tree (slave) in a subdirectory of each working tree using it (master)
- the master repository duplicates all the information from slaves
I don't mind the repos getting bigger, but having the copies is quite unacceptable for me. It would force me to reorganize all the projects, so that the copy would get linked. Moreover, editing of a wrong file could easily happen leading to confusion.
I've got another idea:
- Each master stores a list of all its slaves.
- No other information in the master is required.
- With each commit in master, a "snapshot-commit" in the slave gets created.
- The "snapshot-commit" is a snapshot of the current state of the working tree, it ignores the current state of the index (I'm already using "snapshot-commits" before throwing away some uncommited changes).
- The "snapshot-commits" get collected in a branch whose name is derived from the master's name. The commit message contains the hash of the master commit. (IMHO, this is better than flooding by thousands of tags.)
- A checkout works as usual, unless recursion into slaves is required.
The only problems I can see are the following:
- The commits in the slaves will accumulate, and never get deleted even when the master commits no longer exist.
- Commits in the master are not self-containing, you could delete a commit referred in the master. But I see no chance it could happen by accident, so I can live with it.
- I can't imagine, how other git command could support this. But again, I can live with it.
I'm asking if somebody already implemented it (or if it's a bad idea).