What is the difference between git clone, git clone –bare and git clone –mirror?

Technology CommunityCategory: GitWhat is the difference between git clone, git clone –bare and git clone –mirror?
VietMX Staff asked 3 years ago
  • git clone origin-url is primarily used to point to an existing repo and make a clone or copy of that repo at in a new directory. It has its own history, manages its own files, and is a completely isolated environment from the original repository.
  • git clone --base origin-url makes a copy of the remote repository with an omitted working directory. Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping. Neither remote-tracking branches nor the related configuration variables are created.
  • git clone --mirror origin-url will clone all the extended refs of the remote repository, and maintain remote branch tracking configuration. All local references (including remote-tracking branchesnotes etc.) will be overwritten each time you fetch, so it will always be the same as the original repository.