Git1.8.5 (October 2013) should simplify the process. Simply do a:
git mv A B
git mv A B", when moving a submodule
Ahas been taught to relocate its working tree and to adjust the paths in the
See more in commit 0656781fadca1:
Currently using "
git mv" on a submodule moves the submodule's work tree in that of the superproject. But the submodule's path setting in
.gitmodulesis left untouched, which is now inconsistent with the work tree and makes git commands that rely on the proper
path -> name mapping(like
diff) behave strangely.
git mv" help here by not only moving the submodule's work tree but also updating the "
submodule.<submodule name>.path" setting from the
.gitmodulesfile and stage both.
This doesn't happen when no
.gitmodulesfile is found and only issues a warning when it doesn't have a section for this submodule. This is because the user might just use plain gitlinks without the
.gitmodulesfile or has already updated the path setting by hand before issuing the "git mv" command (in which case the warning reminds him that
mvwould have done that for him).
.gitmodulesis found and contains merge conflicts the
mvcommand will fail and tell the user to resolve the conflict before trying again.
git 2.9 (June 2016) will improve
git mv for submodule:
mv: allow moving nested submodules
git mv old new" did not adjust the path for a submodule that lives as a subdirectory inside
submodules however need to update their link to the git directory as well as updates to the