threads / discuss / 24421

Git Fetch / updating HEAD

Subject: Git Fetch / updating HEAD

## tl;dr

3 messages between Jul 17, 2010 and Jul 17, 2010.

replies: 2people: 2as markdown or json

Mahesh Vaidya· Jul 17, 2010, 15:32 UTC · lore
Hi,

git fetch --all --append updates FETCH_HEAD. I'd like this command to update HEAD as well; is there any flag ?

I have a reason to do it; trying to implement multisite
A (master) -> B (readonly mirror) -> C (workspace)
if sitting in B; git fetch does't update HEAD
Mahesh Vaidya
Mahesh Vaidya· Jul 17, 2010, 15:35 UTC · re: Mahesh Vaidya · lore

Re: Git Fetch / updating HEAD

BTW - I have tried this git update-ref HEAD FETCH_HEAD; is this ok ??

On Sat, Jul 17, 2010 at 9:02 PM, Mahesh Vaidya <forvaidya@gmail.com> wrote:
Show 14 quoted lines
> Hi,
>
> git fetch --all --append updates FETCH_HEAD. I'd like this command to
> update HEAD as well; is there any flag ?
>
> I have a reason to do it; trying to implement multisite
>
> A (master) -> B (readonly mirror) -> C (workspace)
>
> if sitting in B; git fetch does't update HEAD
>
>
> Mahesh Vaidya
>
-- 
Thank you and best regards.
Mahesh Vaidya  / 9740500144
http://www.twitter.com/forvaidya
Johan Herland· Jul 17, 2010, 16:11 UTC · re: Mahesh Vaidya · lore

Re: Git Fetch / updating HEAD

On Saturday 17 July 2010, Mahesh Vaidya wrote:
> BTW - I have tried this
> git  update-ref HEAD  FETCH_HEAD; is this ok ??
> 
> On Sat, Jul 17, 2010 at 9:02 PM, Mahesh Vaidya <forvaidya@gmail.com> 
wrote:
Show 10 quoted lines
> > Hi,
> > 
> > git fetch --all --append updates FETCH_HEAD. I'd like this command to
> > update HEAD as well; is there any flag ?
> > 
> > I have a reason to do it; trying to implement multisite
> > 
> > A (master) -> B (readonly mirror) -> C (workspace)
> > 
> > if sitting in B; git fetch does't update HEAD

You need to set up special refspecs in your B repo, so that git fetch updates refs/heads/* instead of refs/remotes/origin/*. When that is done, a simple 'git fetch' will update your branches (and HEAD as a result).

In short, you should create the B repo using 'git clone --mirror' (which will set up the correct refspecs for you)

...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net

← back to recent threads