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

Re: Why does adding an existing repo as a submodule modify .git/config?

From
Mark Levedahl <mlevedahl@gmail.com>
Date
May 25, 2011, 01:06 UTC
Message-ID
<4DDC562C.2000204@gmail.com>
In-Reply-To
<4DDB58D9.2090701@cdwilson.us>
On 05/24/2011 03:06 AM, Christopher Wilson wrote:
Show 9 quoted lines
>>
>> Mark
>
>
> Q: Can you elaborate on why a 2 step "git submodule add" + "git
> submodule init" wasn't sufficient?  What is the reason for adding this
> functionality into the "git submodule add" command, when "git submodule
> init" does the same job?
>

git-submodule.sh has evolved considerably over the last couple of years, and the behaviour of submodule-init on an already existing module may well be different.

However, while you could then change submodule-add to not register the submodule, you would now have the condition of having a submodule that is checked out in the current tree but *not* registered in .git/config. This is the key: .git/config is modified to include all submodules that are checked out in your current tree. If you add a remote submodule, that submodule is not checked out in your current tree so no entry is created in .git/config, while adding one that is already checked out in place does modify .git/config. I see no inconsistency here.

Mark
Previous: Christopher WilsonNext: Christopher Wilson
Message 5 of 7 in “Why does adding an existing repo as a submodule modify .git/config?”
  1. Christopher WilsonMay 22, 2011
  2. Jens LehmannMay 23, 2011
  3. Mark LevedahlMay 24, 2011
  4. Christopher WilsonMay 24, 2011
  5. Mark LevedahlMay 25, 2011
  6. Christopher WilsonMay 25, 2011
  7. Jens LehmannMay 26, 2011

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.