Suppose origin has a few branches (master (HEAD), next, pu, and maint), some tags (v1, v2, v3), some remote branches (devA/master, devB/master), and some other refs (refs/foo/bar, refs/foo/baz, which might be notes, stashes, other devs’ namespaces, who knows).
git clone(non-bare): You will get all of the tags copied, a local branchmaster (HEAD)tracking a remote branchorigin/master, and remote branchesorigin/next,origin/pu, andorigin/maint. The tracking branches are set up so that if you do something likegit fetch origin, they’ll be fetched as you expect. Any remote branches (in the cloned remote) and other refs are completely ignored.git clone --mirror: Every last one of those refs will be copied as-is. You’ll get all the tags, local branchesmaster (HEAD),next,pu, andmaint, remote branchesdevA/masteranddevB/master, other refsrefs/foo/barandrefs/foo/baz. Everything is exactly as it was in the cloned remote. Remote tracking is set up so that if you rungit remote updateall refs will be overwritten from origin, as if you’d just deleted the mirror and recloned it. As the docs originally said, it’s a mirror. It’s supposed to be a functionally identical copy, interchangeable with the original.
To summarize,
git cloneis used when we need to point to an existing repo and make a clone or copy of that repo at in a new directory.git clone --mirroris used to clone all the extendedrefsof the remote repository, andmaintainremote branch tracking configuration.