我知道我可以告诉Git显示像
这样的进展Resolving deltas: 98% (123/125)
将命令行参数--progress
传递给,例如获取命令。但是我们有几个大的子模块,没有显示进展。如何告诉Git还显示克隆子模块的进度(例如作为fetch命令的一部分)?
答案 0 :(得分:9)
从Git v2.11.0开始,git submodule
接口接受您可以使用的--progress
选项。它完全符合您的期望。
请参阅:https://github.com/git/git/commit/72c5f88311dab7149fcca1f6029414ccb776fee8
不幸的是,截至今天,--progress
的支持尚未在帮助文本(git submodule --help
)中公布。
答案 1 :(得分:1)
我最接近的是使用此命令:
git fetch --recurse-submodules=yes --jobs=10
这不会给你一个进度条。但它加速了存储库的获取。这对于一个包含~30个子模块的微服务项目有很大帮助。
当然,您可以将其与其他命令结合使用,例如,更新所有存储库而不会产生潜在冲突:
# run all subprojects updates: Pull on currently selected branches
#git submodule foreach 'git rebase origin/master; true'
git submodule foreach '
export BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
git status -bs
if [[ "master" == $BRANCH_NAME ]]
then
git merge FETCH_HEAD --ff-only
else
echo \"NOTE this branch is $BRANCH_NAME. You must merge/rebase yourself!\"
fi
'