Ok, I've just been reading up on this and I think I understand it.

HEAD is normally a symbolic name for the commit that corresponds to the working 
copy in a repository.  It is stored in .git/HEAD (mine usually says "ref: 
refs/heads/master" indicating that HEAD is tracking the master branch).

However, a *remote* can also have a HEAD, which is a default branch on that 
remote (the default branch is used if you omit the branch name when using that 
remote).  It is not a property of the remote repo, it is something that gets 
set up on the local repo when you create the reference to the remote.  Whether 
a remote has a HEAD or not probably depends on how it was created - some of my 
remotes have HEADs and some don't, I'm not entirely sure why.

You can set the HEAD for a remote with 'git remote set-head <branch>'.  This 
has no effect other than to give you a way to avoid typing a branch name 
sometimes.  Nothing gets pushed to the remote repo.

Now, having an actual real branch called "HEAD" is almost certainly going to 
cause pain - I'm surprised that git allowed it to happen.  Mind you, git isn't 
known for going out of its way to be helpful... :)  You might have to manually 
remove the branch by removing .git/refs/heads/HEAD and deleting any references 
to it in .git/config.

Cheers,
   Simon

________________________________________
From: Manuel M T Chakravarty [[email protected]]
Sent: 20 June 2011 13:23
To: Simon Peyton-Jones
Cc: Simon Marlow; [email protected]; [email protected]
Subject: Re: [commit: dph] branch 'HEAD' created

Simon Peyton-Jones:
> HEAD is part of git.  It means "the current branch".
> http://stackoverflow.com/questions/2304087/what-is-git-head-exactly
>
> It's definitely confusing to have a branch actually called HEAD!
>
> If we do, let's nuke it.  But I think that
>   haskell.org/HEAD -> haskell.org/master              <=========== HERE
> simply means that the "current branch" at the origin is master.

If that is the case, why does my GitHub GHC repository not have that same set 
up?  GitHub only has

> | >   origin-GitHub/encoding
> | >   origin-GitHub/ghc-generics
> | >   origin-GitHub/ghc-new-co
> | >   origin-GitHub/local-gc
> | >   origin-GitHub/master
> | >   origin-GitHub/monad-comp
> | >   origin-GitHub/patch-4404
> | >   origin-GitHub/patch-5084
> | >   origin-GitHub/supercompiler

which is all, except HEAD.  Something must be different in the haskell.org repo.

> In any case would you like to delete the HEAD branch in dph that you created 
> by mistake?  If indeed it still exists, which it doesn't seem to:
>
> simonpj@cam-04-unx:~/code/validate-HEAD/libraries/dph$ git branch -r
>  origin/HEAD -> origin/master
>  origin/master

I think it does, because it is this funny alias:

>  origin/HEAD -> origin/master

If I try to delete it, I get the following error message:

> error: dst refspec HEAD matches more than one.
> error: failed to push some refs to 'http://darcs.haskell.org/packages/dph.git'


Manuel

> | -----Original Message-----
> | From: Manuel M T Chakravarty [mailto:[email protected]]
> | Sent: 19 June 2011 13:00
> | To: Simon Marlow
> | Cc: [email protected]
> | Subject: Re: [commit: dph] branch 'HEAD' created
> |
> | No, I didn't mean to do that.  In fact, I did actually find it quite 
> confusing that
> | the ghc repos have always had HEAD branches:
> |
> | > withinreason chak 214 (.../Code/ghc): git branch -r
> | >   ghc-test/master
> | >   haskell.org/HEAD -> haskell.org/master          <=========== HERE
> | >   haskell.org/encoding
> | >   haskell.org/ghc-generics
> | >   haskell.org/ghc-new-co
> | >   haskell.org/local-gc
> | >   haskell.org/master
> | >   haskell.org/monad-comp
> | >   haskell.org/patch-4404
> | >   haskell.org/patch-5084
> | >   haskell.org/supercompiler
> | >   origin-GitHub/encoding
> | >   origin-GitHub/ghc-generics
> | >   origin-GitHub/ghc-new-co
> | >   origin-GitHub/local-gc
> | >   origin-GitHub/master
> | >   origin-GitHub/monad-comp
> | >   origin-GitHub/patch-4404
> | >   origin-GitHub/patch-5084
> | >   origin-GitHub/supercompiler
> |
> | As you can see that is not the case in the GitHub remote (also listed 
> above).  The '-
> | > haskell.org/master' seems to indicate that it is a kind of alias (but I'm 
> not sure
> | - this is beyond my git-fu).
> |
> | I didn't explicitly created a HEAD branch in the dph repo.  I think I 
> accidentally
> | pushed to HEAD instead of master and that made git send out that email.  
> But it seems
> | to have also broken something about that branch alias thingy, as I now get 
> an error
> | message when 'git fetch'ing in the repo I pushed from :/
> |
> | Can we maybe get rid of all the HEAD (alias) branches to avoid such 
> mistakes?
> |
> | Manuel
> |
> |
> | Simon Marlow:
> | > Do you really want a branch called 'HEAD'? That's likely to cause 
> confusion surely?
> | >
> | > Cheers,
> | > Simon
> | >
> | > -----Original Message-----
> | > From: Manuel Chakravarty
> | > Sent: 19 June 2011 06:56
> | > To: [email protected]
> | > Subject: [commit: dph] branch 'HEAD' created
> | >
> | >
> | > Repository : ssh://darcs.haskell.org//srv/darcs/packages/dph
> | >
> | > New branch : HEAD
> | > Referencing: d43c0162a58e40ae645176324091ad76d3cdfce9




_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to