我有一堆视频存放在名为“videos”的目录中。我不幸地把这个巨大的文件夹提交到了git,导致git在某些活动(如克隆)时非常缓慢。因此,我进行了一些研究,并发现了git子模块,但我似乎不是很理解它们。
这是我所做的:
这是我所做的:
- I created a separate repository just for the videos at ssh://dev.example.org/var/git/project/microsite_videos and put the videos in there.
- I deleted the videos from my main repo at ssh://dev.example.org/var/git/project/microsite and committed the delete. I realize this doesn't remove the videos from history, but I wanted to make sure I understood submodules before I change history.
I added the videos back as a submodule:
git submodule add ssh://dev.example.org/var/git/project/microsite_videos videos
I committed these changes to master.
这是我的.gitmodules文件:
[submodule "videos"]
path = videos
url = ssh://dev.example.org/var/git/project/microsite_videos
一开始看起来还好,但是我对它的某些行为感到困惑。特别是刚才我将主分支合并到一个分支时,视频文件夹就消失了。.gitmodules文件仍然存在,但是任何尝试拉取或更新视频文件夹的操作都只会给我一个新提示,而不会做任何事情。
我做错了什么,如何提高对子模块的理解,以便在每次尝试分支和合并时不必挣扎?