I wasn’t sure how to word the question, so apologies if it’s not clear. If you git clone a repo that had a bunch of dangling objects, do you clone those? Same for the opposite. If you did a git gc and pushed that to someone else, does their repo lose anything the git gc would have cleaned up?
I would guess that neither of these would occur, but I can’t find any documentation on this scenario.
I found some information that seems to imply that with most protocols git clone gives you a clean repo, but if you specify the file using a file path it copies everything.
The main reason to specify the file:// prefix is if you want a clean copy of the
repository with extraneous references or objects left out.
Git clone doesn’t clone dangling objects.
And your
git gcwill not in any way affect the remote repo when you push to it, unless your push causes dangling objects and then agit gcis run on remote to remove those.Unless….
It was a shared clone ( specified with the
--sharedor-sflag) or a local clone (--localor-l). From the docs:So when you do a
git clone /path/to/repoyou are copying the objects ( or creating hardlinks) and you will get the dangling object in this case. In other cases ( using git protocols, ssh, file protocol etc. ) you will never get the dangling objects in the clone.Look here for how the transport happens – http://progit.org/book/ch9-6.html