It's not possible to rename it, so you've to remove it first (deinit
) and add it again.
So after removing it:
git submodule deinit <path>
git rm --cached <path>
you may also double check and remove the references to it in:
.gitmodules
.git/config
- remove reference folder from
.git/modules/<name>
(best to make a backup), as each folder has config
file where it keeps the reference to its worktree
then stage your changes by committing any changes to your repo by:
git commit -am 'Removing submodule.'
and double check if you don't have any outstanding issues by:
git submodule update
git submodule sync
git submodule status
so now you can add the git submodule again:
git submodule add --name <custom_name> [email protected]:foo/bar.git <my/path>
.gitmodules
manually when moving a submodule. see my answer below – Cuddlenpm
shows how simple works. One day... maybe... someone... will rewrite it... in the meantime... – Antiquary