0 votes
1 view
in Devops and Agile by (20k 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 (28.4k 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

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