Quickly clone a large git repo
We usually do this:
git clone <url>
Works most of the time, except when you have a 1GB repo with lots of old branches.
You should instead do this:
git clone -b <branch> <url> --depth=1
This retrieves just the latest commit for the specific branch you specify.
You can also use the depth directive when pulling a branch:
git pull --rebase origin <branch> --depth=1
Written by Radamanthus Batnag
Related protips
2 Responses
Bear in mind that you can't commit to a shallowly cloned repo.
over 1 year ago
·
Actually, you can, if the history is simple enough. See: http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone
It works most of the time if you have branches that don't diverge much from each other.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#