Re: [SOLVED] `git fetch tag NAME' into mirror repo does not update HEAD, what to do?
- From
Tomas Carnecky <tom@dbservice.com>
- Date
- Aug 12, 2010, 13:34 UTC
- Message-ID
- <4C63F860.2090600@dbservice.com>
- In-Reply-To
- <201008121522.55020.brian.foster@innova-card.com>
On 8/12/10 3:22 PM, Brian Foster wrote:
Show 8 quoted lines
> On Thursday 12 August 2010 14:32:41 Tomas Carnecky wrote: >> When you use >> 'git update-ref --no-deref HEAD v2' it will modify HEAD > > NO, it gets an error (following is from a modified version > of my previously-posted script): > + git update-ref --no-deref HEAD v2 > error: Trying to write non-commit object 2bc324e6a68cb3704448c9f63ddc3bc0260c0b48 to branch HEAD
Oh the subtleties when working with plumbing: git update-ref --no-deref HEAD v2^{commit}
Show 14 quoted lines
> Using ‘git update-ref --no-deref HEAD FETCH_HEAD’ does > not error, and, as you say (below), does seem to give > me a detached head. > >> 'git update-ref --no-deref HEAD v2' it will modify HEAD directly and >> have it point directly to the same commit as v2 (also called detached HEAD). > > I do_not_ want a detached head! This has perhaps been > confused by my improperly saying “update HEAD” when I > meant “update the master branch”. If you look back at > my originally-posted diagrams, it's a reasonable guess > I don't want a detached head. Having HEAD continue to > be a symref to refs/heads/master (which, in this case, > is the same commit as v2) is correct.
Just make sure your tools and scripts don't break when you reset the branch like that (especially when the update is non-fast forward as fetch+reset won't warn you when this happens).
tom