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

Bug in `git branch --delete main` when on other orphan branch

From
Martin von Zweigbergk <martinvonz@google.com>
Date
Oct 29, 2022, 05:46 UTC
Message-ID
<CAESOdVBpsbJ0obD=qDjHBJg-wwWUL5sQ-7X_h13Vw39Q9QUzHA@mail.gmail.com>
Hi,

I did this: git init test cd test echo a > file git add file git commit -m a git checkout --orphan other git branch --delete main

The last command fails with: fatal: Couldn't look up commit object for HEAD

That's a bug, right? I can of course work around it with `rm .git/refs/heads/main`.

Next: Jeff King
Message 1 of 12 in “Bug in `git branch --delete main` when on other orphan branch”
  1. Martin von ZweigbergkOct 29, 2022
  2. Jeff KingNov 1, 2022
  3. Martin von ZweigbergkNov 1, 2022
  4. Taylor BlauNov 1, 2022
  5. Taylor BlauNov 1, 2022
  6. Jeff KingNov 1, 2022
  7. Taylor BlauNov 2, 2022
  8. branch: gracefully handle '-d' on detached HEADTaylor Blau, Nov 1, 2022
  9. branch: gracefully handle '-d' on orphan HEADJeff King, Nov 2, 2022
  10. Rubén JustoNov 4, 2022
  11. Jeff KingNov 4, 2022
  12. Rubén JustoNov 6, 2022

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.