假设我有以下项目结构:
.git
--APP
-----F
--LIBS
------A
-------.git
------B
-------.git
------C
-------.git
------D
-------.git
Run Code Online (Sandbox Code Playgroud)
F是APP文件夹下的子文件夹.
A, B, C并且D是位于LIBS文件夹下的四个子模块.
我想要做的是将F文件夹解压缩到另一个存储库(目前它只是一个简单的子文件夹).
到目前为止,我已经完成了以下工作:
for remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote; done
Run Code Online (Sandbox Code Playgroud)
之后,我跑了:
git filter-branch --prune-empty --tag-name-filter cat --subdirectory-filter APP/F/ -- --all
Run Code Online (Sandbox Code Playgroud)
结果是:
.git
--F
--LIBS
------A
-------.git
------B
-------.git
------C
-------.git
------D
-------.git
Run Code Online (Sandbox Code Playgroud)
看起来层次结构中的子模块仍然重写历史.
但是,我想要的结果是只保留F目录,没有其他子模块..:
--F
---.git
Run Code Online (Sandbox Code Playgroud)