Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only fetch the latest git revision #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

divinity76
Copy link

@divinity76 divinity76 commented Sep 29, 2021

if you don't want the entire revision history of git, but only the latest revision, this speeds up the cloning process/bandwidth/diskspace

  • on my laptop, this took the cloning process down from 83.5 seconds to 6.4 seconds (that's a reduction of 92% !), and diskspace requirements down from 230 MB to 59 MB (a reduction of 74% !)

root@xDevAd:/temp2/test# time git clone --depth 1 --shallow-submodules git://github.com/git/git
Cloning into 'git'...
remote: Enumerating objects: 4080, done.
remote: Counting objects: 100% (4080/4080), done.
remote: Compressing objects: 100% (3599/3599), done.
remote: Total 4080 (delta 379), reused 1931 (delta 311), pack-reused 0
Receiving objects: 100% (4080/4080), 9.83 MiB | 3.69 MiB/s, done.
Resolving deltas: 100% (379/379), done.

real 0m6,418s
user 0m1,194s
sys 0m0,786s
root@xDevAd:/temp2/test# mv git git_shallow
root@xDevAd:/temp2/test# time git clone git://github.com/git/git
Cloning into 'git'...
remote: Enumerating objects: 314519, done.
remote: Counting objects: 100% (1619/1619), done.
remote: Compressing objects: 100% (818/818), done.
remote: Total 314519 (delta 1054), reused 1188 (delta 801), pack-reused 312900
Receiving objects: 100% (314519/314519), 172.30 MiB | 3.26 MiB/s, done.
Resolving deltas: 100% (234622/234622), done.
Updating files: 100% (3982/3982), done.

real 1m23,581s
user 1m4,861s
sys 0m19,944s
root@xDevAd:/temp2/test# du -h git_shallow | tail -n1
59M git_shallow
root@xDevAd:/temp2/test# du -h git | tail -n1
230M git

if you don't want the entire revision history of git, but only the latest revision, this speeds up the cloning process/bandwidth/diskspace

- on my laptop, this took the cloning process down from 83.5 seconds to 6.4 seconds, and diskspace requirements down from 230 MB to 59 MB

root@xDevAd:/temp2/test# time git clone --depth 1 --shallow-submodules git://github.com/git/git
Cloning into 'git'...
remote: Enumerating objects: 4080, done.
remote: Counting objects: 100% (4080/4080), done.
remote: Compressing objects: 100% (3599/3599), done.
remote: Total 4080 (delta 379), reused 1931 (delta 311), pack-reused 0
Receiving objects: 100% (4080/4080), 9.83 MiB | 3.69 MiB/s, done.
Resolving deltas: 100% (379/379), done.

real	0m6,418s
user	0m1,194s
sys	0m0,786s
root@xDevAd:/temp2/test# mv git git_shallow
root@xDevAd:/temp2/test# time git clone git://github.com/git/git
Cloning into 'git'...
remote: Enumerating objects: 314519, done.
remote: Counting objects: 100% (1619/1619), done.
remote: Compressing objects: 100% (818/818), done.
remote: Total 314519 (delta 1054), reused 1188 (delta 801), pack-reused 312900
Receiving objects: 100% (314519/314519), 172.30 MiB | 3.26 MiB/s, done.
Resolving deltas: 100% (234622/234622), done.
Updating files: 100% (3982/3982), done.

real	1m23,581s
user	1m4,861s
sys	0m19,944s
root@xDevAd:/temp2/test# du -h git_shallow | tail -n1
59M	git_shallow
root@xDevAd:/temp2/test# du -h git | tail -n1
230M	git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant