Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
342 views
in Technique[技术] by (71.8m points)

git - 如何删除子模块?(How do I remove a submodule?)

How do I remove a Git submodule?

(如何删除Git子模块?)

By the way, is there a reason I can't simply do git submodule rm whatever ?

(顺便说一句,有一个原因我不能简单地做git submodule rm whatever吗?)

  ask by R. Martinho Fernandes translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Via the page Git Submodule Tutorial :

(通过页面Git Submodule Tutorial :)

To remove a submodule you need to:

(要删除子模块,您需要:)

  1. Delete the relevant section from the .gitmodules file.

    (从.gitmodules文件中删除相关部分。)

  2. Stage the .gitmodules changes:

    (.gitmodules更改:)
    git add .gitmodules

  3. Delete the relevant section from .git/config .

    (从.git/config删除相关部分。)

  4. Remove the submodule files from the working tree and index:

    (从工作树和索引中删除子模块文件:)
    git rm --cached path_to_submodule (no trailing slash).

    (git rm --cached path_to_submodule (无尾斜杠)。)

  5. Remove the submodule's .git directory:

    (删除子模块的.git目录:)
    rm -rf .git/modules/path_to_submodule

  6. Commit the changes:

    (提交更改:)
    git commit -m "Removed submodule <name>"

  7. Delete the now untracked submodule files:

    (删除现在未跟踪的子模块文件:)
    rm -rf path_to_submodule

See also : alternative steps below .

(另请参阅以下替代步骤 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...