git fetch/pull 非常慢的解决办法

某同学把一些很多很大的文件 push 进入了 repo。导致后面的 pull 非常慢。
在本地删除了这些文件后,强制 push 到一个新的 Branch:
$ git push -u mzhanhui zhanhui2.1:zhanhui2.1

在生产机上 fetch branch 依旧非常缓慢,用如下命令fetch:

$ git fetch mzhanhui -u –depth 1

Usage: git fetch [<options>] [<repository> [<refspec>…]]
or: git fetch [<options>] <group>
or: git fetch –multiple [<options>] [(<repository> | <group>)…]
or: git fetch –all [<options>]

-v, –verbose be more verbose
-q, –quiet be more quiet
–all fetch from all remotes
-a, –append append to .git/FETCH_HEAD instead of overwriting
–upload-pack <path> path to upload pack on remote end
-f, –force force overwrite of local branch
-m, –multiple fetch from multiple remotes
-t, –tags fetch all tags and associated objects
-n do not fetch all tags (–no-tags)
-p, –prune prune remote-tracking branches no longer on remote
control recursive fetching of submodules
–dry-run dry run
-k, –keep keep downloaded pack
-u, –update-head-ok allow updating of HEAD ref
–progress force progress reporting
–depth <depth> deepen history of shallow clone
–unshallow convert to a complete repository

然后 checkout 远程的 Repo 到本地:

$ git checkout -b zhanhui2.1 mzhanhui/zhanhui2.1

作者: 甬洁网络