Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何优雅地删掉 Git submodule (How effectively delete a git submodule) #16

Open
yangruihan opened this issue Nov 16, 2020 · 0 comments
Labels

Comments

@yangruihan
Copy link
Owner

如何优雅地删掉 Git submodule (How effectively delete a git submodule)

参考地址:https://gist.github.com/myusuf3/7f645819ded92bda6677

步骤

  • .gitmodules文件中删除对应子模块的节(section)
  • 通过git add .gitmodules命令将.gitmodules文件添加到待提交区
  • .git/config文件中删除对应子模块的节(section)
  • 运行git rm --cached xxxx(子模块路径)命令
  • 运行rm -rf .git/modules/xxxx(子模块路径)命令
  • 通过git commit -m "删除子模块"命令提交删除操作
  • 通过rm -rf xxxx(子模块路径)将子模块彻底从项目中删除

原文

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@yangruihan yangruihan added the git label Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant