git 子模块“--reference”参数
git submodule "--reference" parameter
在git submodule add
的git submodule文档中,显示有一个--reference
参数。据推测,这与 git clone
的 --reference
参数的工作方式相同,通过从中复制对象而不是远程存储库。使用此参数执行后,如果我查看 .git/modules/<submodule>/objects/info
,有一个 alternates
文件,其中包含引用 repo 的路径。
但是,git clone
也有一个 --dissociate
参数,基本上只对初始克隆执行此操作。有没有办法为子模块存储库做同样的事情?
显然唯一的方法是在使用 --reference
.
克隆子模块目录后 运行 git repack -a -d
我猜想未来的 Git 版本可能会为 git submodule {add,update}
本身添加对 --dissociate
的直接支持,但它在最新的 (2.15) 版本中还不存在。
"git submodule update
" 和 "git submodule add
" 支持 "--reference
" 选项以像 "git clone
" 一样从邻近的本地存储库借用对象,但缺少最近的发明“--dissociate
”。
Git 2.18(2018 年第 2 季度)不再如此
submodule: add --dissociate
option to add/update commands
Add --dissociate
option to add and update commands, both clone helper commands that already have the --reference
option --dissociate
pairs with.
The documentation 现在添加:
--dissociate::
This option is only valid for add
and update
commands.
These commands sometimes need to clone a remote repository. In this case, this option will be passed to the git clone
command.
在git submodule add
的git submodule文档中,显示有一个--reference
参数。据推测,这与 git clone
的 --reference
参数的工作方式相同,通过从中复制对象而不是远程存储库。使用此参数执行后,如果我查看 .git/modules/<submodule>/objects/info
,有一个 alternates
文件,其中包含引用 repo 的路径。
但是,git clone
也有一个 --dissociate
参数,基本上只对初始克隆执行此操作。有没有办法为子模块存储库做同样的事情?
显然唯一的方法是在使用 --reference
.
git repack -a -d
我猜想未来的 Git 版本可能会为 git submodule {add,update}
本身添加对 --dissociate
的直接支持,但它在最新的 (2.15) 版本中还不存在。
"git submodule update
" 和 "git submodule add
" 支持 "--reference
" 选项以像 "git clone
" 一样从邻近的本地存储库借用对象,但缺少最近的发明“--dissociate
”。
Git 2.18(2018 年第 2 季度)不再如此
submodule: add
--dissociate
option to add/update commandsAdd
--dissociate
option to add and update commands, both clone helper commands that already have the--reference
option--dissociate
pairs with.
The documentation 现在添加:
--dissociate::
This option is only valid for
add
andupdate
commands.
These commands sometimes need to clone a remote repository. In this case, this option will be passed to thegit clone
command.