简体   繁体   中英

.git size difference between local repo and other local repo copied from first repo using incremental bundles

I'd like to sync a local repo which.git is in ~/ to google drive. I've been adviced to forget about copying directly files to google drive and to use bundles. On the local repo meant to be synced, I've done several commits, without any branch created. Afterwards, I've tagged every commit, tags names ranging from t0 to t25. The local repo.git size is 2.6G. Then I create the different bundle files using bash: Bundle0 is the bundle obtained with HEAD pointing at the first commit tagged t0, Bundle1 is the incremental bundle corresponding just to the second commit tagged t1, Bundle2 is the incremental bundle corresponding to what whas committed at commit tagged t2 and so on, thus Bundle(i) is the incremental bundle corresponding to commit tagged ti

cd ~
git switch --detach t0
git bundle create bundle0 HEAD
i=0;while [[ i -le 24 ]];do
let j=i+1; git switch --detach t$j;
git bundle create bundle$j t$i..HEAD;
let i=j;done

Then I have bundle0...bundle25 I go to the folder where I want to use the bundle files to "clone" ~ git repo:

cd /mnt/d
mkdir tmp/
cd tmp/
i=0; while [[ i -le 25 ]];do git pull ~/bundle$i; let i=i+1;done

Things work fine, but there's a huge size difference between both.git folder, as /mnt/d/tmp/.git is 968M whereas ~/.git is 2.6G

If I do git log in both ~/ and /mnt/d/tmp folders, I get the same commit sequences. I tried then to compare both git repos by copying the original as a remote in /mnt/d/tmp and then run git diff:

cd /mnt/d/tmp
git remote add -f b ~/.git
git remote update
git diff master remotes/b/master

Last command doesnt output anything, seems the two repository are identical.

Finally as both.git directory have substantially different sizes, I am wondering wether my incremental bundle "cloning" really work or if I miss plenty of files or files revision from the original repo in the bundle copied repo.

Any idea? Thanks for your help !

Git repacks for storage efficiency at long-ish intervals, and any history-schlepping creates a single pack of the schlepped history, so clones tend to be smaller than the repo they're cloned from.

The core command to do a default-settings major repack is git repack -ad , you can hunt up the conveniences, git prune , git gc , git maintenance la la.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM