Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)

The git clone help page has this to say about --mirror:

Set up a mirror of the remote repository. This implies --bare.

But doesn't go into detail about how the --mirror clone is different from a --bare clone.

1 Answer

0 votes
by (27.5k points)

$ git clone --bare

This command will make the new itself the $GIT_DIR. And the branch heads at the remote are copied directly to corresponding local branch heads, without mapping. When you use this option, neither remote-tracking branches nor the related configuration variables are created.

$ git clone --mirror

Just like the bare clone, a mirrored clone includes all remote branches and tags, but all local references (including remote-tracking branches, notes etc.) will be overwritten each time you fetch, so this will always be the same as the original repository.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.5k answers


108k users

Browse Categories