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

Re: Should "git symbolic-ref -d HEAD" be forbidden?

From
Andreas Schwab <schwab@linux-m68k.org>
Date
Sep 2, 2016, 09:19 UTC
Message-ID
<87wpiuy7z2.fsf@linux-m68k.org>
In-Reply-To
<xmqqpoonuy4n.fsf@gitster.mtv.corp.google.com>
On Sep 01 2016, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> I think we should.
>
> t1401 expects to be able to, but if you really do it:
>
> 	$ cd /tmp
> 	$ git init throwaway
>         $ cd throwaway
>         $ git symbolic-ref -d HEAD
>
> the setup machinery considers that you are no longer in a working
> tree that is controlled by a repository at .git/ because .git/ is
> no longer a valid repository, so you cannot even do
>
> 	$ git symbolic-ref HEAD refs/heads/master
>
> to recover.
git init recovers it, though.
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Previous: Jeff King
Message 5 of 5 in “Should "git symbolic-ref -d HEAD" be forbidden?”
  1. Junio C HamanoSep 1, 2016
  2. Jeff KingSep 1, 2016
  3. Junio C HamanoSep 1, 2016
  4. Jeff KingSep 2, 2016
  5. Andreas SchwabSep 2, 2016

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.