浅clone
# 关闭compression
git config --global core.compression 0
# 部分clone,浅clone
git clone --depth 1 <repo_URI>
# 下载剩下的没clone部分
git fetch --unshallow
# 下载剩下的没clone部分
git fetch --depth=2147483647
# 正常更新
git pull --all
渐进下载
#!/bin/bash
# for i in {1..2147483647..100}
for (( i=1; i<2147483647; i+=100))
do
cmd="git fetch --depth=${i}"
echo "${cmd}"
eval "${cmd}"
done
计算仓库深度
git rev-list HEAD --count
渐进下载2
#!/bin/bash
DEPTH=1000
DELTA=500
SPEED=500
LOCK=.git/shallow.lock
if [ -e ${LOCK} ]; then
rm -f ${LOCK}
fi
while true; do
echo "git fetch -k --depth=${DEPTH}, DELTA=${DELTA}"
git fetch -k --depth=${DEPTH}
if [ $? -eq 0 ]; then
DEPTH=$[DEPTH + DELTA]
DELTA=$[DELTA + SPEED]
else
DEPTH=$[DEPTH - DELTA]
DELTA=$[DELTA/2]
DEPTH=$[DEPTH + DELTA]
fi
done