git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git submodule repository locatio

From
Adam Stankiewicz <sheerun@sher.pl>
Date
Apr 24, 2013, 14:44 UTC
Message-ID
<5177EFCD.1020300@sher.pl>

Currently each submodule contains single .git file (instead of directory) with only link to project's base repository, for example "gitdir: ../../.git/modules/lib/neobundle.vim".

In git base repository we find .git/modules directory that contains bare repositories of all submodules, for example .git/modules/lib/neobundle.vim contains bare repository of neobundle submodule.

My proposal is to move default bare repository location from .git/modules to .git directory inside submodule, like every normal git repo do.

These are my arguments:
1. Why git submodule needs to know in which project it is embedded in? Or
even that it's generally submodule? When cd to submodule, it behaves like
normal repository. Only repository needs to know about its submodules.
2. You can't move submodule outside git repository and use it as normal git
repo. You have to copy bare repo from .git/modules dir.
3. It's not enough to delete submodule from workingdir to "refresh" it
later. You have to go to .git/modules directory and delete appropriate
folder.
What about performance on checkouts?

In systems supporting symlinks, the .git directory in submodule can be a symlink to the .git/modules subdirectory. In systems that do not support them, you can use mv-like command, that is very fast. Just move .git directory of submodule to .git/modules subdirectory, until you you need it (when you check out commit with "Subproject commit 55d868e(...) object").

I propose introducing this change in next major version of git, as it can break some scripts that depend on git submodule repository location.

Please consider this "feature request" seriously, most people I know think git submodules suck, and described issue is IMHO one of the reasons why.

Sincerely, Adam Stankiewicz (@sheerun)

Next: Fredrik Gustafsson
Message 1 of 2 in “Git submodule repository locatio”
  1. Adam StankiewiczApr 24, 2013
  2. Fredrik GustafssonApr 24, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.