Convert a Git folder to a submodule retrospectively?

前端 未结 6 1126
执念已碎
执念已碎 2020-11-28 18:49

Quite often it is the case that you\'re writing a project of some kind, and after a while it becomes clear that some component of the project is actually useful as a standal

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 19:25

    It can be done, but it's not simple. If you search for git filter-branch, subdirectory and submodule, there are some decent write-ups on the process. It essentially entails creating two clones of your project, using git filter-branch to remove everything except the one subdirectory in one, and removing only that subdirectory in the other. Then you can establish the second repository as a submodule of the first.

提交回复
热议问题