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

bug report: spurious "cannot delete branch '%s' used by worktree"

From
TDTamir Duberstein <tamird@fuseenergy.com>
Date
Mar 28, 2024, 14:53 UTC
Message-ID
<CAEYvaskGHYrQgke=gf1sXYhrwbd+SeTpcjGF0fpxK3hQbyPFKg@mail.gmail.com>
Pasting the output of `git bugreport`:

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

I created a branch, pushed to a remote, and then the remote deleted the branch. Then I tried to delete the local branch.

What did you expect to happen? (Expected behavior)
The branch to be deleted.
What happened instead? (Actual behavior)
% git branch -d cleanup
error: cannot delete branch 'cleanup' used by worktree at '<my source dir>'
% git worktree list
<my source dir>  dc46f6d5e [main]
% git branch
  cleanup
* main
What's different between what you expected and what actually happened?

Git reports the branch is being used by a worktree, but prints the current repository's directory, where a different branch is clearly checked out.

Anything else you want to add:

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.44.0 cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon uname: Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:25 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6030 arm64 compiler info: clang: 15.0.0 (clang-1500.1.0.2.5) libc info: no libc information available $SHELL (typically, interactive shell): /bin/zsh

[Enabled Hooks]
Next: Eric Sunshine
Message 1 of 11 in “bug report: spurious "cannot delete branch '%s' used by worktree"”
  1. Tamir DubersteinMar 28, 2024
  2. Eric SunshineMar 28, 2024
  3. Tamir DubersteinMar 28, 2024
  4. Eric SunshineMar 31, 2024
  5. Tamir DubersteinMar 31, 2024
  6. Phillip WoodApr 2, 2024
  7. Tamir DubersteinApr 2, 2024
  8. Kristoffer HaugsbakkApr 2, 2024
  9. phillip.wood123@gmail.comApr 2, 2024
  10. Tamir DubersteinApr 2, 2024
  11. phillip.wood123@gmail.comApr 2, 2024

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.