Git Mirror with Different Branches

318 views Asked by At

I am working on Android Source Code, and I used mirror to let the time of sync faster.

$ mkdir mirror
$ cd mirror
$ repo init branchA --mirror
$ repo sync

Then, I can use this mirror when I need to sync branchA each time.

$ repo init branchA --reference=/.../mirror
$ repo sync

But now, I have a question, I have other branches which are related to branchA. For instance, branchB is based on branchA, and banchC is based on branchB. In this case, should I need three different mirror ?

If I only sync branchC's mirror, Can I use this mirror to sync branchA and branchB ?

If I only sync branchA's mirror, Can I use this mirror to sync branchB and branchC ?

1

There are 1 answers

3
ElpieKay On BEST ANSWER

You need only one mirror.

Repo's mirror repositories are fully cloned. They contain every git object reachable from all the branches, tags and other refs. repo sync's option -c, which downloads only the current ref and its objects, will take no effect in mirror repositories.

Even if the mirror has only one branch's data, you can still use it as reference to download other refs. The missing refs and objects, which can't be found in the mirror, will be downloaded from the remote server. You won't miss anything in the working repositories.