删除git子模块但保留文件 [英] remove git submodule but keep files
问题描述
我有一个git子模块,我想成为我的主项目的一部分(因为我有很多项目特定的代码将进入子模块)。
因此,我想删除对子模块的git引用,并将这些文件添加到我的主git存储库。
但是如何?
16581096/6309> gitlink条目: mv subfolder subfolder_tmp
git submodule deinit子文件夹
git rm --cached子文件夹
mv subfolder_tmp子文件夹
git添加子文件夹
将子文件夹
替换为子模块的文件夹名称,并确保不添加任何结尾斜杠。
这是我在删除Git子模块?和 $ b
- 缓存的
选项允许您将子文件夹的内容保留在磁盘中...除 git submodule deini t
无论如何都已经删除了该内容。因此, mv
部分。
您可以添加并提交该子文件夹。
I have a git submodule that I would like to become part of my main project (since I have a lot of project specific code that will go into the submodule).
So I'd like to remove the git references to the submodule and add the files to my main git repository.
But how ?
You must remove the gitlink entry in your index:
mv subfolder subfolder_tmp
git submodule deinit subfolder
git rm --cached subfolder
mv subfolder_tmp subfolder
git add subfolder
Replace subfolder
with the name of the folder for your submodule, and make sure to not add any trailing slash.
This is what I detail in "Remove a Git submodule?" and "un-submodule a git submodule".
The --cached
option allows you to keep the subfolder content in your disk... except git submodule deinit
would already have removed that content anyway. Hence the mv
part.
You then can add and commit that subfolder.
这篇关于删除git子模块但保留文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!