Re: [Q] `git fetch tag NAME' into mirror repo does not update HEAD, what to do?
From: Brandon Casey <hidden>
Date: 2016-06-15 22:49:18
Brian Foster wrote:
Bare repository ORIG's master looks like this:
o--o--o--o--v1--o--v2--o--o--o HEAD
where v1 and v2 are (annotated) tagged commits.
Repository SLAVE is a mirror clone of ORIG which
(very deliberately!) lags behind (i.e., its HEAD
is one of the earlier (and usually tagged) commits
on ORIG). SLAVE's master was like this:
o--o--o--o--v1 HEAD
We wanted to update its HEAD to v2, so did:
git fetch ORIG tag v2
This gave us:
o--o--o--o--v1 HEAD
\
o--v2
It did not update SLAVE's HEAD to v2, which we wanted.Are you using --mirror only so that the branch pointer in the mirror repository will be updated when you fetch? If you are not really interested in having a "real" mirror, then maybe you should set your mirror up to track a specific branch (or branches) in the mirrored repository. You could have a branch named for example "for_mirror/master", in the mirrored repository (ORIG) that you would prepare. You could update the for_mirror/master branch when you were ready using 'git branch' like this: git branch -f for_mirror/master v2 In the mirror repository (SLAVE), you would update the fetchspec so that the mirror mirrored the branches below the "for_mirror" namespace in the remote repository like this: fetch = +refs/heads/for_mirror/*:refs/heads/* Then, a simple 'git fetch' would fetch the updates (including tags) and update the branch pointer in the mirror like you want it to do. Tracking multiple branches this way is possible just by creating another branch in the ORIG repository with the proper name. -Brandon