I would like to change the directory name of a Git submodule in my Git superproject.
Lets suppose I have the following entry in my .gitmodules file:
The trick seems to be understanding that the .git directory for submodules are now kept in the master repository, under .git/modules, and each submodule has a .git file that points to it. This is the procedure you need now:
.git file in the submodule's working directory, and modify the path it contains so that it points to the right directory in the master repository's .git/modules directory..git/modules directory, and find the directory corresponding to your submodule.config file, updating the worktree path so that it points to the new location of the submodule's working directory..gitmodules file in the root of the master repository, updating the path to the working directory of the submodule.git add -ugit add (It's important that you add the parent, and not the submodule directory itself.)A few notes:
[submodule "submodule-name"] lines in .gitmodules and .git/config must match each other, but don't correspond to anything else..git directory must correctly point to each other..gitmodules and .git/config files should be synchronised.