Initial Situation / Goal
I have a GIT repository with a submodule let's say under <root>/Modules/SomePath/Example
.
I want to move this submodule to a new location, let's say <root>/LocalStuff/NewName
.
What I did
I basically followed How do I move an existing Git submodule within a Git repository and
created folder
<root>/LocalStuff/NewName
used
git mv /Modules/SomePath/Example/* /LocalStuff/NewName/
in
.gitmodules
changed from[submodule "Modules/SomePath/Example"] path = Modules/SomePath/Example url = xxxxxxxxx
to
[submodule "LocalStuff/NewName"] path = LocalStuff/NewName url = xxxxxxxxx
in the now
LocalStuff/NewName/.git
changed fromgitdir: ../../.git/modules/Modules/SomePath/Example
to
gitdir: ../../.git/modules/LocalStuff/NewName
created according folder
<root>/.git/modules/LocalStuff/NewName
moved all content from
<root>/.git/modules/Modules/SomePath/Example
into<root>/.git/modules/LocalStuff/NewName
in the now
<root>/.get/modules/LocalStuff/NewName/config
changed from
worktree = ../../../../Modules/SomePath/Example
to
worktree = ../../../../LocalStuff/NewName
Issue / Question
At first glance this worked fine and when I clone my branch everything is fine.
However, when switching between the "main" branch and my "MoveSubmodule" branch forth and back I get a warning
warning: unable to rmdir 'LocalStuff/NewName': Directory not empty
or accordingly
warning: unable to rmdir 'Modules/SomePath/Example': Directory not empty
with the result that the submodule is only there once but its content is there twice in the two locations. They are not tracked in GIT as changes though so even if I again delete them manually this is not a change I can commit.
Have I missed / screwed up anything?