Hi, thanks for answering.

>> I would like to be able to tell my users that they can simply do:
>>
>> git clone --git-dir=_/git/module1/.git module1-url
>> git clone --git-dir=_/git/module2/.git module2-url
>>
>> which will overlay the files from both modules into the current
>> directory, which from git's perspective is the work-tree for both
>> modules.
>
> Would there be a sensible semantics in the resulting working tree?
> Which repository would a new file in such a combined working tree
> belong to?

The developer would have to decide by way of `git add`.

Ignoring other repos' files would be done by way of local config
option `excludesfile` (.gitignore is out).

To make it easier to work with git this way, a script that creates a
subshell in the context of a repo can be done with something like
`PS1="[$1 $PS1]" GIT_DIR=_git/$1/.git bash -i" -- git would then work
as usual in that subshell for that specific repo, never leaving the
working tree.


I successfully employed the above scheme with luapower[1] packages,
which are all different and mostly unrelated libraries, but which need
to be overlaid over a common directory structure. And that's just an
example. I can think of many projects that are modularized and yet the
modules need to place many files in many places to make a working
system (web frameworks, the linux filesystem, etc.)

Currently, to clone a repo one has to do:

export GIT_DIR=_git/submodule/.git
git init
git config --local core.worktree ../../..
git remote add origin ssh://g...@github.com/luapower/submodule.git
git fetch
git branch --track master origin/master
git checkout

That's 6 commands for what could be:

    git clone --git-dir=_git/submodule/.git
ssh://g...@github.com/luapower/submodule.git

Or even better:

    git clone --git-dirs=_git ssh://g...@github.com/luapower/submodule.git

[1] http://luapower.com
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to