How is mirror cloning in git so fast and small?

I did some potentially dangerous rewrites of history, so I decided to make a clone with the option --mirror. I was surprised by the sparkling fast cloning. And somehow the resulting repo is less than 1 MB, and the original repo is more than 300 MB (after git gc --aggressive). How is this possible? Does it use git clone --mirrorany magic? or i lose data when i clone--mirror

I used du -sto find out how much disk space it takes.

+3
source share
1 answer

The key is not in the option --mirror, but in --local, which is the default for clones in the same file system:

--local [...] .git/objects/hardleded             , .

, .

--no-hardlinks .

+3

All Articles