Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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 https://github.com/example

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 https://github.com/example

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

Browse Categories

...