How do I move an existing Git submodule within a Git repository?

后端 未结 10 659
面向向阳花
面向向阳花 2020-11-29 14:39

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:

10条回答
  •  借酒劲吻你
    2020-11-29 14:49

    The most modern answer, taken from Valloric's comment above:

    1. Upgrade to Git 1.9.3 (or 2.18 if the submodule contains nested submodules)
    2. git mv old/submod new/submod
    3. Afterwards the .gitmodules and the submodule directory are already staged for a commit (you can verify this with git status.)
    4. Commit the changes with git commitand you're good to go!

    Done!

提交回复
热议问题