简体   繁体   中英

What is the difference between git clone --mirror and pull

There really is no difference between clone and pull is my understanding. Or in other words git clone -- bare and git pull does the same. But since git clone --mirror updates the local references would it be different from pull ?


EDIT: I mistakenly assumed git clone default is --bare. But --bare will be setup without working directory.

git clone creates a new repository. You had no repository before, and now you have one.

git pull does operations in an existing repository.

That seems like a really big difference!

Other than that, what git pull does is:

  • run git fetch , then
  • run a second Git command.

Since a --mirror clone is a --bare clone and therefore has no work-tree, the second command that git pull would run will fail, no matter whether you choose merge or rebase.

What git fetch does is documented . With a mirror clone, the default refspec is +refs/*:refs/* , so that all references are replaced with those obtained from the other Git.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM