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

git submodule init and redundant data in .gitmodules/.git/config

From
MKmartin f krafft <madduck@madduck.net>
Date
Aug 15, 2007, 16:20 UTC
Message-ID
<20070815162005.GA18463@piper.oerlikon.madduck.net>
Hi,

I am starting to learn submodules and hit the first state of confusion when I encountered git-submodule init:

After git-submodule add, I find in my repository a .gitmodules file as well as the newly-cloned submodule. I can call git-submodule status on it to get the HEAD hash. The .gitmodules file has a stanza for each submodule, linking remote url to local path, e.g.:

  [submodule "foo"]
    path = foo
    url = ../foo.git
The manpage then talks about git-submodule init:
    init
      Initialize the submodules, i.e. register in .git/config each
      submodule name and url found in .gitmodules. The key used in
      .git/config is submodule.$name.url. This command does not
      alter existing information in .git/config.

When I run git-submodule init, the following stanza gets added to .git/config:

  [submodule "foo"]
    url = ../foo.git
Unless I call init, I cannot use git-submodule update.

But looking at the two stanzas, it strikes me that the remote url of the submodule is duplicated and detached, creating redundant data which may become desynchronised.

Why is this?

What is the reason for git-submodule init and moving the data to .git/config?

Thanks,
-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
"it is only the modern that ever becomes old-fashioned." 
                                                        -- oscar wilde
 
spamtraps: madduck.bogus@madduck.net
Next: Sven Verdoolaege
Message 1 of 7 in “git submodule init and redundant data in .gitmodules/.git/config”
  1. martin f krafftAug 15, 2007
  2. Sven VerdoolaegeAug 15, 2007
  3. using .gitmodule as default (was: git submodule init and redundant data in .gitmodules/.git/config)martin f krafft, Aug 15, 2007
  4. Josef WeidendorferAug 16, 2007
  5. martin f krafftAug 16, 2007
  6. Josef WeidendorferAug 16, 2007
  7. Lars HjemliAug 17, 2007

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.