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

Detached HEAD warning (again)

From
PBPieter de Bie <pdebie@ai.rug.nl>
Date
Mar 30, 2009, 16:09 UTC
Message-ID
<9099EAF5-6B43-4F15-A905-9E21B45B7AE9@ai.rug.nl>
Hi all,

I strongly remember there being a discussion about this a few weeks ago, but I can't find it. Basically, someone wanted to introduce a warning every time someone commits on a detached HEAD. This was shot down because there already is a big warning when you detach your HEAD (with which I agree).

However, someone here: http://news.ycombinator.com/item?id=538619 pointed to an example here: http://book.git-scm.com/5_submodules.html , which works with submodules:

	$ git submodule update --init
	# sub/ is created
	$ (cd sub && touch a && git add a && git commit -am "Add new file")
	[detached HEAD 8641889] Add new file
	 0 files changed, 0 insertions(+), 0 deletions(-)
	 create mode 100644 a
	$ git submodule update
	$ ls sub/a
	ls: sub/a: No such file or directory

Now, it DOES say 'detached HEAD', but I still think this is something easily missed and something that can cause a lot of confusion. Perhaps a warning in such cases wouldn't hurt?

- Pieter
Next: Johannes Schindelin
Message 1 of 4 in “Detached HEAD warning (again)”
  1. Pieter de BieMar 30, 2009
  2. Johannes SchindelinMar 31, 2009
  3. Pieter de BieMar 31, 2009
  4. Junio C HamanoApr 1, 2009

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.