基于git子模块创建一个胖git存储库

我想知道是否可以这样做:

  1. git clone --recursive <repository with submodule>
  2. git remote add fat-repository <path>
  3. ???
  4. git add -A && git commit -m "Test" && git push fat-repository master

第3步将对存储库进行 de-submodule 的保存,保留 submodule 的内容,但删除所有属于其子模块的跟踪。

谢谢!

iCMS 回答:基于git子模块创建一个胖git存储库

要删除子模块

# Remove the submodule entry from .git/config
git submodule deinit -f path/to/submodule

# Remove the submodule directory from the superproject's .git/modules directory
rm -rf .git/modules/path/to/submodule

# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
git rm -f path/to/submodule
,

https://www.atlassian.com/git/articles/core-concept-workflows-and-tips

部分:如何将子模块重新集成到项目中?

这包含从子模块创建胖git存储库的正确方法:

  1. git rm --cached submodule_path (no trailing slash)
  2. git rm .gitmodules
  3. rm -rf submodule_path/.git
  4. git add submodule_path; git commit -m "remove submodule"

特别感谢尼克·克罗斯(Nick Cross)向我指出这些说明!

本文链接:https://www.f2er.com/1883876.html

大家都在问