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

Re: git clean is not removing a submodule added to a branch when switching branches

From
Jens Lehmann <jens.lehmann@web.de>
Date
Feb 20, 2012, 20:36 UTC
Message-ID
<4F42AEE7.9060103@web.de>
In-Reply-To
<CAGc=MuDrE_1CVzOsqcodhadcfajaa-BHjHVAp9mFDNbU=wVQqQ@mail.gmail.com>
Am 18.02.2012 22:27, schrieb Adrian Cornish:
Show 5 quoted lines
> If I add a submodule to a branch and then switch branches, git
> checkout warns it cannot
> remove the submodule. If I then issue a git clean - it says it removes
> the submodule but
> in fact does nothing at all. Is this a bug or expected behaviour.

Right this is just how things work. I won't call it expected behavior, as some users (like you) would expect to see the submodule be removed (while others are used to the current behavior that submodule work trees are never touched).

But one of last years GSoC projects took first steps into the direction of safely removing submodules (without losing any history). I have experimental code at my Github repo [1] to update submodule work trees along with the superproject, but polishing that for inclusion into mainline will still take some time.

[1] https://github.com/jlehmann/git-submod-enhancements
Previous: Adrian Cornish
Message 2 of 2 in “git clean is not removing a submodule added to a branch when switching branches”
  1. Adrian CornishFeb 18, 2012
  2. Jens LehmannFeb 20, 2012

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.