git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git shouldn't allow to push a new branch called HEAD

From
P Rouleau <prouleau72@gmail.com>
Date
Oct 14, 2011, 23:00 UTC
Message-ID
<loom.20111015T004856-72@post.gmane.org>
In-Reply-To
<1318591877.2938.20.camel@mastroc3.mobc3.local>
Daniele Segato <daniele.segato <at> gmail.com> writes:
Show 14 quoted lines
> 
> Hi all,
> 
> following from a discussion in IRC freenode #git between me, sitaram an
> shruggar
> 
> step to reproduce:
> 
> $ # time to create the remote HEAD branch
> $ cd buggenerator/
> $ git push origin HEAD:HEAD
> 
> But I think that git shouldn't allow the remote HEAD reference to be
> created in the first place

Maybe git should also refuse to create a local branch named HEAD. I made a mistake recently where I used something likes this:

for B in $(git branch -a|grep "remotes/origin/"); do git co -t $B ; done

After that, git st was giving a warning about an ambiguous HEAD ref. Hopefully, a simple "git branch -d HEAD" fixed it once I found the problem.

P.Rouleau
Previous: Jeff King
Message 8 of 8 in “Git shouldn't allow to push a new branch called HEAD”
  1. Daniele SegatoOct 14, 2011
  2. Daniele SegatoOct 14, 2011
  3. Daniele SegatoNov 14, 2011
  4. Michael HaggertyNov 14, 2011
  5. Jeff KingNov 14, 2011
  6. Junio C HamanoNov 14, 2011
  7. Jeff KingNov 14, 2011
  8. P RouleauOct 14, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.