Rename a git submodule

前端 未结 7 2182
-上瘾入骨i
-上瘾入骨i 2020-12-04 05:32

Is there some easy way to rename a git submodule directory (other than going through the entire motion of deleting it and re-adding it with a new destination name).

<
7条回答
  •  孤街浪徒
    2020-12-04 06:18

    I found following workflow working:

    • Update .gitmodules
    • mv oldpath newpath
    • git rm oldpath
    • git add newpath
    • git submodule sync

    Note: this approach does not update the index and .gitmodules properly in 2018 versions of GIT.

    Note: You may be able to now just do git mv oldpath newpath now, as pointed out in VonC's answer. (Ensure you are using the latest version of git)

提交回复
热议问题