发布于 2022-09-30 20:08:34
我在前端和后端没有知识,所以我的答案将基于我在Git中的知识。您可以在另一个回购中添加一个回购作为子模块。这样做后,您可以导航到子模块,并处理它作为正常回购。
例如,考虑到您已经克隆了frontendmentor-challenges
,现在导航到它,并将FEM-calculator-project
和FEM-Landing-page
作为子模块添加到frontendmentor-challenges
中。
添加子模块:
$ git submodule add <remote_url> /*of the repo that you want to add as submodule*/
$ git commit -m "comment"
$ git push
有很多关于子模块的知识,比如更新子模块等等。我希望这对你有用:)
发布于 2022-10-02 22:08:14
有时,我们希望在存储库(父回购)中添加一些存储库(子回购),但希望独立地管理子存储。
当我们需要子模块时,您可以先请参阅
将子回购添加到父回购(相同的克隆)中,您可以检查cat .git/config
。然后,您可以添加,提交正常。
git submodule add <link child repos>
在某些情况下,您不是要提取Git子模块,而是只需要更新项目中现有的Git子模块。就像您在模块A上编写代码一样,但需要在模块B上使用新特性
git submodule update --remote --merge
当您克隆paren repos时,git不自动复制子模块,您必须更新和拉出子模块。
git submodule update --init
git submodule update --recursive --remote
git pull --recurse-submodules
当不再使用子模块时,可以删除它。
git submodule deinit <path_to_submodule_folder> -f
git rm <path_to_submodule_folder>
git commit -m "Remove submodule" .
rm -rf .git/modules/<path_to_submodule_folder>
我也不多用A,所以我知道这里有一些用法。
希望这能帮到你。
https://stackoverflow.com/questions/73912717
复制相似问题