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

switching branches when they use different submodule remotes

From
SBStephen Bannasch <stephen.bannasch@deanbrook.org>
Date
Apr 8, 2011, 17:52 UTC
Message-ID
<p0624080dc9c4f8ff178c@[192.168.1.122]>
I was confused earlier today when I switched branches in a repo with libgit2 in a submodule.

I knew that the different branches used different remotes for the submodule -- one remote is older, the other remote has newer development.

   git://github.com/pieter/libgit2.git
   git://repo.or.cz/libgit2.git
so when I switched I deleted the whole libgit2 dir and ran:
   git submodule init
   git submodule update

I was switching to the branch that referenced git://github.com/pieter/libgit2.git and I was surprised the newer branch was cloned instead.

Looking at the doc for git submodule:
   http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html

it made it clear that executing init does not alter existing information in .git/config so I deleted the reference in ./git/config manually and started over.

Is there a better way to handle this?
Next: Junio C Hamano
Message 1 of 2 in “switching branches when they use different submodule remotes”
  1. Stephen BannaschApr 8, 2011
  2. Junio C HamanoApr 8, 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.