1

When configuring a git submodule, is it possible to reference a path of the submodule?

For example, I have a git repo (e.g. "SomeApp") with src/app/SomeApp directory in it. I want to add it to MyParent, which has src/app/MyParent directory in it. If I add a submodule with something like git submodule add -b branch git/me/SomeApp src/app/SomeApp, then SomeApp is cloned into the target path, and I end up with src/app/SomeApp/src/app/SomeApp.

Is it possible to map the submodule's src/app/SomeApp directly to MyParent's src/app directory, so that both SomeApp and MyParent are there without the extra subdir path on the submod?

Brett
  • 5,690
  • 6
  • 36
  • 63
  • 1
    Git only operates on entire repositories. You can't remap the layout of a repository like that (but you could add it at a different location and then use a symlink to create the hierarchy you want). – larsks Jun 01 '22 at 19:37
  • Was hoping there was some way of doing it with submodule. Thanks. If you want to post your comment as a full answer, i can mark it as the solution here. – Brett Jun 01 '22 at 19:59
  • Does this answer your question? [Git submodule inside of a submodule (nested submodules)](https://stackoverflow.com/questions/1535524/git-submodule-inside-of-a-submodule-nested-submodules) – Arael D. Espinosa Pérez Jun 01 '22 at 22:52
  • Areal - no. This is not for a submod in a submod (in a submod). This is a single submod, but only mapping in a sub-diretory of the single sub module to a different location. – Brett Jun 02 '22 at 14:47

0 Answers0