Git assumes -l when a clone is requested from a local file system, presumably to speed up the clone and save disk space. What are the implications of this type of clone? If I clone a repository twice and then make a commit to one, then will the changes be visible in the other clone? I’m wondering if Git is careful to copy on writes. If the original repository is read only, then will that present problems for the clones?
Git assumes -l when a clone is requested from a local file system, presumably
Share
The
git clonemanpage states about-l:This means that you will get a hardlink for all Git objects which has no real implications because those objects are immutable anyway and Git does not update them once they are created. You also get actual copies of
HEADand other symbolic references, so changes to them in one repository will not be seen in others. If you commit a change, a few new objects will be created under.git/objectsand theHEADreference will be updated to point to the latest commit (which will be one of the newly created objects); no existing objects will be updated, so you don’t have to worry about the hardlinks.The manpage states one implication, which may be of interest:
The downside of hardlinks is that they refer to the same actual inodes on disk, so if one Git object gets corrupted, all your local clones that hardlink to it will have a corrupted object. Without hardlinks, you will have actual backup copies of all of your objects.