threads / discuss / 54225

Combine submodule and worktree with a center cache

Subject: Combine submodule and worktree with a center cache

## tl;dr

2 messages between Sep 11, 2020 and Sep 19, 2020.

replies: 1people: 2as markdown or json

gmail· Sep 11, 2020, 04:24 UTC · lore

Hello, It is possible to combine submodule and worktree with a center cache like `$HOME/.git-modules` to speed up `git submodule update —init` and save disk space. Now I managed them manually. I suppose it will be support by git automatically.

Best wishes.
Luke Diamand· Sep 19, 2020, 19:15 UTC · re: gmail · lore

Re: Combine submodule and worktree with a center cache

On Fri, 11 Sep 2020 at 05:25, gmail <coolnavy2010@gmail.com> wrote:
>
> Hello, It is possible to combine submodule and worktree with a center cache like `$HOME/.git-modules`
> to speed up `git submodule update —init` and save disk space. Now I managed them manually. I suppose it will
> be support by git automatically.
I'm not exactly sure what you are trying to do but if you are doing this:
    git clone --recurse-submodules git@some.server:myrepo
    cd myrepo
    git worktree add /path/to/worktree

then you can make the submodules part of the worktree go faster by using the --reference option:

    cd /path/to/worktree
    git submodule update --reference /path/to/myrepo

That way the submodule syncs don't have to go back to the original server to get the objects, they can get them from the local copy that you've already got.

However, I may have misunderstood what you are trying to do.
Luke

← back to recent threads