-1

In this thread git submodule add error: does not have a commit checked out

I had the exact same experience as the OP, so I read the responses to see if there was a solution. Several people answered that the solution was to delete the .git file in the added submodule. In that thread I asked "But doesn't that defeat the purpose of the submodule and just turn that tree into a local repository without any connection back to where the submodule came from?" (See https://stackoverflow.com/a/75305137/13000598)

So, I'm asking. Is the proper method to handle the situation described by the OP in the original thread to delete the .git subdirectory and, if so, how does that not defeat the purpose of git submodule add?

Am I wrong in believing that it does defeat git submodule add's purpose?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
whdaffer
  • 29
  • 4
  • 1
    “Rather narrowly defined” - really? You think the requirement for an answer to answer the question is narrow? Tough crowd – Clive Feb 08 '23 at 18:33

1 Answers1

1

As explained here, "does not have a commit checked out" means the parent repository still think that a subfolder is still a submodule.

It is best to try and clean any trace of that subfolder, before attempting to add it again as a submodule.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250