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

Re: Problem switching branches in submodule

From
MGManish Gill <mgill25@outlook.com>
Date
Sep 26, 2013, 18:33 UTC
Message-ID
<BLU0-SMTP36066CF18FF63C9BD84AC48B8280@phx.gbl>
In-Reply-To
<20130926180852.GF9464@google.com>
On 09/26/2013 11:38 PM, Jonathan Nieder wrote:
Show 26 quoted lines
> (cc-ing Duy, who knows the setup code well)
> Manish Gill wrote:
> 
>> I have a git repository with lots of submodules. In one particular
>> submodule, I'm having the following problem:
>>
>> If I try to switch branches at the top-level of that submodule, I succeed.
>>
>> But, if I try to switch branches in any subsequen levels, I get the
>> following error:
>>
>>     fatal: internal error: work tree has already been set
>>     Current worktree: ../path/Mailman3/rest_project
>>     New worktree: ../path/Mailman3/rest_project/website/public_rest
>>
>> Here, Mailman3 is the primary repository and "rest_project" is a
>> submodule. I can do "git checkout" just fine
>> inside rest_project, but not after cd-ing into any other repos.
>>
>> My git version is 1.8.4
>>
>> Other commands, like git status, push/pull are working fine.
> 
> Interesting.  Yeah, this shouldn't happen.
> 
> What is the exact command you use to get the above output?  
git checkout <branch_name>
Is your
> repository public (which would let us reproduce it) or can you
> reproduce it by creating a small artificial test repository
The repo isn't public, I'm afraid.

I should mention what *exactly* happened that led to this. I was trying to publish my branch on Launchpad (using git-remote-bzr). At some point, I had the genius idea to remote the extra stuff from the config file and just try with the bzr:: remote as origin, and instead of doing it via the console, I just replaced the config file.

Annnnyway, I just restored my backed up config file for that submodule in the middle of writing this and seems like things seem to work now.

I dunno, this was most likely because of some configuration derp on my part (the new config file didn't contain the branch information most likely). So I guess problem solved!

Thanks for your help.
Previous: Jonathan NiederNext: Jonathan Nieder
Message 3 of 6 in “Problem switching branches in submodule”
  1. Manish GillSep 26, 2013
  2. Jonathan NiederSep 26, 2013
  3. Manish GillSep 26, 2013
  4. Jonathan NiederSep 26, 2013
  5. Manish GillSep 26, 2013
  6. Duy NguyenSep 26, 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.