{"thread":{"id":"61218","subject":"bug report: spurious \"cannot delete branch '%s' used by worktree\"","startedAt":"2024-03-28T14:53:50Z","lastAt":"2024-04-02T15:15:40Z","messageCount":11,"participants":["Tamir Duberstein","Eric Sunshine","Phillip Wood","Kristoffer Haugsbakk","phillip.wood123@gmail.com"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"491751","messageId":"CAEYvaskGHYrQgke=gf1sXYhrwbd+SeTpcjGF0fpxK3hQbyPFKg@mail.gmail.com","threadId":"61218","inReplyTo":null,"subject":"bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"Tamir Duberstein","fromEmail":"tamird@fuseenergy.com","sentAt":"2024-03-28T14:53:37Z","receivedAt":"2024-03-28T14:53:50Z","isPatch":false,"sender":{"key":"tamird@fuseenergy.com","avatar":null},"body":"Pasting the output of `git bugreport`:\n\nThank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\nI created a branch, pushed to a remote, and then the remote deleted the branch.\nThen I tried to delete the local branch.\n\nWhat did you expect to happen? (Expected behavior)\n\nThe branch to be deleted.\n\nWhat happened instead? (Actual behavior)\n\n% git branch -d cleanup\nerror: cannot delete branch 'cleanup' used by worktree at '<my source dir>'\n% git worktree list\n<my source dir>  dc46f6d5e [main]\n% git branch\n  cleanup\n* main\n\nWhat's different between what you expected and what actually happened?\n\nGit reports the branch is being used by a worktree, but prints the current\nrepository's directory, where a different branch is clearly checked out.\n\nAnything else you want to add:\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.44.0\ncpu: arm64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:25\nPDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6030 arm64\ncompiler info: clang: 15.0.0 (clang-1500.1.0.2.5)\nlibc info: no libc information available\n$SHELL (typically, interactive shell): /bin/zsh\n\n\n[Enabled Hooks]\n"},{"id":"491765","messageId":"CAPig+cQWW1sLXyTBvk6D+1h15sZCtQO1opfhtFfiHr_kX0y82g@mail.gmail.com","threadId":"61218","inReplyTo":"CAEYvaskGHYrQgke=gf1sXYhrwbd+SeTpcjGF0fpxK3hQbyPFKg@mail.gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2024-03-28T17:24:06Z","receivedAt":"2024-03-28T17:24:18Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Mar 28, 2024 at 10:54 AM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n> % git branch -d cleanup\n> error: cannot delete branch 'cleanup' used by worktree at '<my source dir>'\n> % git worktree list\n> <my source dir>  dc46f6d5e [main]\n> % git branch\n>   cleanup\n> * main\n\nIs this error persistent once it arises? That is, if you invoke `git\nbranch -d cleanup` again immediately after (or a little while after)\nthe above sequence, does the problem persist? Or does it \"clear up\" on\nits own at some point?\n"},{"id":"491769","messageId":"CAEYvaskXRyxNTLNeRPPyawFrBVRgCbSnJiuF7D7cOGiaDq=V2Q@mail.gmail.com","threadId":"61218","inReplyTo":"CAPig+cQWW1sLXyTBvk6D+1h15sZCtQO1opfhtFfiHr_kX0y82g@mail.gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"Tamir Duberstein","fromEmail":"tamird@fuseenergy.com","sentAt":"2024-03-28T17:39:55Z","receivedAt":"2024-03-28T17:40:07Z","isPatch":false,"sender":{"key":"tamird@fuseenergy.com","avatar":null},"body":"Yes, the problem is persistent. The branch is never deleted.\n\n\nOn Thu, Mar 28, 2024 at 5:24 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n>\n> On Thu, Mar 28, 2024 at 10:54 AM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n> > % git branch -d cleanup\n> > error: cannot delete branch 'cleanup' used by worktree at '<my source dir>'\n> > % git worktree list\n> > <my source dir>  dc46f6d5e [main]\n> > % git branch\n> >   cleanup\n> > * main\n>\n> Is this error persistent once it arises? That is, if you invoke `git\n> branch -d cleanup` again immediately after (or a little while after)\n> the above sequence, does the problem persist? Or does it \"clear up\" on\n> its own at some point?\n"},{"id":"491917","messageId":"CAPig+cQdFi5zBkDQWTEWXCTt5h9gVFNJv7obf=tWCkOvsaEHEA@mail.gmail.com","threadId":"61218","inReplyTo":"CAEYvaskXRyxNTLNeRPPyawFrBVRgCbSnJiuF7D7cOGiaDq=V2Q@mail.gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2024-03-31T06:49:12Z","receivedAt":"2024-03-31T06:49:24Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"[please reply inline rather than top-posting; I've moved your reply\ninline for this response]\n\nOn Thu, Mar 28, 2024 at 1:40 PM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n> On Thu, Mar 28, 2024 at 5:24 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n> > On Thu, Mar 28, 2024 at 10:54 AM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n> > > % git branch -d cleanup\n> > > error: cannot delete branch 'cleanup' used by worktree at '<my source dir>'\n> > > % git worktree list\n> > > <my source dir>  dc46f6d5e [main]\n> > > % git branch\n> > >   cleanup\n> > > * main\n> >\n> > Is this error persistent once it arises? That is, if you invoke `git\n> > branch -d cleanup` again immediately after (or a little while after)\n> > the above sequence, does the problem persist? Or does it \"clear up\" on\n> > its own at some point?\n>\n> Yes, the problem is persistent. The branch is never deleted.\n\nI'd guess that there may be some sort of \"ref\" still pointing at the\n\"cleanup\" branch which presumably was, at some point, checked out at\n\"<my source dir>\". Digging through the code[1,2,3] suggests that you\nmight have some stale state from a rebase, bisect, or other sequencer\noperation which still references the \"cleanup\" branch.\n\n[Cc'ing Phillip who is probably much more familiar with this code than am I.]\n\nBy the way, it's not clear from your initial report what you mean when\nyou say \"then the remote deleted the branch\". Also, did you fetch\nand/or pull from the remote after that?\n\n[1]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L454\n[2]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L386\n[3]: https://github.com/git/git/blob/d6fd04375f91/sequencer.c#L6551\n"},{"id":"491922","messageId":"CAEYvas=baW9DWQY4_MJ2-Hh0=yYwH2tGeOOwkcJr3wETCKpy4w@mail.gmail.com","threadId":"61218","inReplyTo":"CAPig+cQdFi5zBkDQWTEWXCTt5h9gVFNJv7obf=tWCkOvsaEHEA@mail.gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"Tamir Duberstein","fromEmail":"tamird@fuseenergy.com","sentAt":"2024-03-31T07:45:53Z","receivedAt":"2024-03-31T07:46:06Z","isPatch":false,"sender":{"key":"tamird@fuseenergy.com","avatar":null},"body":"On Sun, Mar 31, 2024 at 7:49 AM Eric Sunshine <sunshine@sunshineco.com> wrote:\n>\n> [please reply inline rather than top-posting; I've moved your reply\n> inline for this response]\n>\n> On Thu, Mar 28, 2024 at 1:40 PM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n> > On Thu, Mar 28, 2024 at 5:24 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n> > > On Thu, Mar 28, 2024 at 10:54 AM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n> > > > % git branch -d cleanup\n> > > > error: cannot delete branch 'cleanup' used by worktree at '<my source dir>'\n> > > > % git worktree list\n> > > > <my source dir>  dc46f6d5e [main]\n> > > > % git branch\n> > > >   cleanup\n> > > > * main\n> > >\n> > > Is this error persistent once it arises? That is, if you invoke `git\n> > > branch -d cleanup` again immediately after (or a little while after)\n> > > the above sequence, does the problem persist? Or does it \"clear up\" on\n> > > its own at some point?\n> >\n> > Yes, the problem is persistent. The branch is never deleted.\n>\n> I'd guess that there may be some sort of \"ref\" still pointing at the\n> \"cleanup\" branch which presumably was, at some point, checked out at\n> \"<my source dir>\". Digging through the code[1,2,3] suggests that you\n> might have some stale state from a rebase, bisect, or other sequencer\n> operation which still references the \"cleanup\" branch.\n>\n> [Cc'ing Phillip who is probably much more familiar with this code than am I.]\n>\n> By the way, it's not clear from your initial report what you mean when\n> you say \"then the remote deleted the branch\". Also, did you fetch\n> and/or pull from the remote after that?\n>\n> [1]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L454\n> [2]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L386\n> [3]: https://github.com/git/git/blob/d6fd04375f91/sequencer.c#L6551\n\nThanks, I wasn't aware of the etiquette.\n\nI had used the branch to send a pull request on GitHub, and then\ndeleted the remote branch from GitHub after merging the pull request.\nYes, I have fetched from the remote following that. I've also manually\nremoved the remote tracking branch. Symptoms remain unchanged.\n\nIf you can suggest where to go looking for stale state, I'm happy to\nprovide more information. I'll take a look at the code references as\nwell.\n"},{"id":"492036","messageId":"4041487e-d8d8-481c-b490-884e31f533a8@gmail.com","threadId":"61218","inReplyTo":"CAPig+cQdFi5zBkDQWTEWXCTt5h9gVFNJv7obf=tWCkOvsaEHEA@mail.gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2024-04-02T10:10:23Z","receivedAt":"2024-04-02T10:10:26Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Tamir\n\nOn 31/03/2024 07:49, Eric Sunshine wrote:\n> [please reply inline rather than top-posting; I've moved your reply\n> inline for this response]\n> \n> On Thu, Mar 28, 2024 at 1:40 PM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n>> On Thu, Mar 28, 2024 at 5:24 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n>>> On Thu, Mar 28, 2024 at 10:54 AM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n>>>> % git branch -d cleanup\n>>>> error: cannot delete branch 'cleanup' used by worktree at '<my source dir>'\n>>>> % git worktree list\n>>>> <my source dir>  dc46f6d5e [main]\n>>>> % git branch\n>>>>    cleanup\n>>>> * main\n>>>\n>>> Is this error persistent once it arises? That is, if you invoke `git\n>>> branch -d cleanup` again immediately after (or a little while after)\n>>> the above sequence, does the problem persist? Or does it \"clear up\" on\n>>> its own at some point?\n>>\n>> Yes, the problem is persistent. The branch is never deleted.\n> \n> I'd guess that there may be some sort of \"ref\" still pointing at the\n> \"cleanup\" branch which presumably was, at some point, checked out at\n> \"<my source dir>\". Digging through the code[1,2,3] suggests that you\n> might have some stale state from a rebase, bisect, or other sequencer\n> operation which still references the \"cleanup\" branch.\n> \n> [Cc'ing Phillip who is probably much more familiar with this code than am I.]\n\nThanks Eric. I'd have thought that \"git worktree list\" would say \nsomething about the branch being rebased if there was enough state lying \naround to prevent the branch being deleted, but lets see. What does\n\n     ls $(git rev-parse --git-path rebase-merge) $(git rev-parse \n--git-path rebase-apply)\n\nshow when you run it in <my source dir>? Also is <my source dir> the \nonly worktree?\n\nBest Wishes\n\nPhillip\n\n> By the way, it's not clear from your initial report what you mean when\n> you say \"then the remote deleted the branch\". Also, did you fetch\n> and/or pull from the remote after that?\n> \n> [1]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L454\n> [2]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L386\n> [3]: https://github.com/git/git/blob/d6fd04375f91/sequencer.c#L6551\n"},{"id":"492038","messageId":"CAEYvasmb1TjwWpSbfSAogbOiB64sZQiHVoUhxvY+NoLmXnRuHA@mail.gmail.com","threadId":"61218","inReplyTo":"4041487e-d8d8-481c-b490-884e31f533a8@gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"Tamir Duberstein","fromEmail":"tamird@fuseenergy.com","sentAt":"2024-04-02T10:26:02Z","receivedAt":"2024-04-02T10:26:15Z","isPatch":false,"sender":{"key":"tamird@fuseenergy.com","avatar":null},"body":"Hi Phillip\n\nOn Tue, Apr 2, 2024 at 11:10 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n>\n> Hi Tamir\n>\n> On 31/03/2024 07:49, Eric Sunshine wrote:\n> > [please reply inline rather than top-posting; I've moved your reply\n> > inline for this response]\n> >\n> > On Thu, Mar 28, 2024 at 1:40 PM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n> >> On Thu, Mar 28, 2024 at 5:24 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n> >>> On Thu, Mar 28, 2024 at 10:54 AM Tamir Duberstein <tamird@fuseenergy.com> wrote:\n> >>>> % git branch -d cleanup\n> >>>> error: cannot delete branch 'cleanup' used by worktree at '<my source dir>'\n> >>>> % git worktree list\n> >>>> <my source dir>  dc46f6d5e [main]\n> >>>> % git branch\n> >>>>    cleanup\n> >>>> * main\n> >>>\n> >>> Is this error persistent once it arises? That is, if you invoke `git\n> >>> branch -d cleanup` again immediately after (or a little while after)\n> >>> the above sequence, does the problem persist? Or does it \"clear up\" on\n> >>> its own at some point?\n> >>\n> >> Yes, the problem is persistent. The branch is never deleted.\n> >\n> > I'd guess that there may be some sort of \"ref\" still pointing at the\n> > \"cleanup\" branch which presumably was, at some point, checked out at\n> > \"<my source dir>\". Digging through the code[1,2,3] suggests that you\n> > might have some stale state from a rebase, bisect, or other sequencer\n> > operation which still references the \"cleanup\" branch.\n> >\n> > [Cc'ing Phillip who is probably much more familiar with this code than am I.]\n>\n> Thanks Eric. I'd have thought that \"git worktree list\" would say\n> something about the branch being rebased if there was enough state lying\n> around to prevent the branch being deleted, but lets see. What does\n>\n>      ls $(git rev-parse --git-path rebase-merge) $(git rev-parse\n> --git-path rebase-apply)\n>\n> show when you run it in <my source dir>? Also is <my source dir> the\n> only worktree?\n\n% ls $(git rev-parse --git-path rebase-merge) $(git rev-parse\n--git-path rebase-apply)\nls: .git/rebase-apply: No such file or directory\nls: .git/rebase-merge: No such file or directory\n\nYes, it's the only worktree.\n\n> Best Wishes\n>\n> Phillip\n>\n> > By the way, it's not clear from your initial report what you mean when\n> > you say \"then the remote deleted the branch\". Also, did you fetch\n> > and/or pull from the remote after that?\n> >\n> > [1]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L454\n> > [2]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L386\n> > [3]: https://github.com/git/git/blob/d6fd04375f91/sequencer.c#L6551\n"},{"id":"492040","messageId":"b331feb8-6af3-4361-9822-31c7440e65f8@app.fastmail.com","threadId":"61218","inReplyTo":"CAEYvasmb1TjwWpSbfSAogbOiB64sZQiHVoUhxvY+NoLmXnRuHA@mail.gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-04-02T10:38:16Z","receivedAt":"2024-04-02T10:39:03Z","isPatch":false,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Tue, Apr 2, 2024, at 12:26, Tamir Duberstein wrote:\n>\n> % ls $(git rev-parse --git-path rebase-merge) $(git rev-parse\n> --git-path rebase-apply)\n> ls: .git/rebase-apply: No such file or directory\n> ls: .git/rebase-merge: No such file or directory\n>\n> Yes, it's the only worktree.\n\nHave you tried `git worktree repair`?\n\n-- \nKristoffer Haugsbakk\n\n"},{"id":"492043","messageId":"740d1f1a-40ce-4714-91bd-1ba448e9d672@gmail.com","threadId":"61218","inReplyTo":"CAEYvasmb1TjwWpSbfSAogbOiB64sZQiHVoUhxvY+NoLmXnRuHA@mail.gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"","fromEmail":"phillip.wood123@gmail.com","sentAt":"2024-04-02T11:28:59Z","receivedAt":"2024-04-02T11:29:01Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Tamir\n\nOn 02/04/2024 11:26, Tamir Duberstein wrote:\n> On Tue, Apr 2, 2024 at 11:10 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n>> On 31/03/2024 07:49, Eric Sunshine wrote:\n>> Thanks Eric. I'd have thought that \"git worktree list\" would say\n>> something about the branch being rebased if there was enough state lying\n>> around to prevent the branch being deleted, but lets see. What does\n>>\n>>       ls $(git rev-parse --git-path rebase-merge) $(git rev-parse\n>> --git-path rebase-apply)\n>>\n>> show when you run it in <my source dir>? Also is <my source dir> the\n>> only worktree?\n> \n> % ls $(git rev-parse --git-path rebase-merge) $(git rev-parse\n> --git-path rebase-apply)\n> ls: .git/rebase-apply: No such file or directory\n> ls: .git/rebase-merge: No such file or directory\n\nThanks for trying that - at least we know it isn't a problem with \nrebase. Lets check if there is a stale bisect (sorry I forgot about that \nearlier). What do\n\n     cat .git/BISECT_START\n     ls .git | grep -i bisect\n\nshow?\n\n> Yes, it's the only worktree.\nIn that case can you check that\n\n     ls .git/worktrees\n\nfails because the directory is missing or shows an empty directory please.\n\nThanks\n\nPhillip\n"},{"id":"492047","messageId":"CAEYvaskG0BBVr+nsQ+iof=AXu3dcQHx0aRRrKRrf8e_NFANL9A@mail.gmail.com","threadId":"61218","inReplyTo":"740d1f1a-40ce-4714-91bd-1ba448e9d672@gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"Tamir Duberstein","fromEmail":"tamird@fuseenergy.com","sentAt":"2024-04-02T11:56:53Z","receivedAt":"2024-04-02T11:57:05Z","isPatch":false,"sender":{"key":"tamird@fuseenergy.com","avatar":null},"body":"On Tue, Apr 2, 2024 at 12:29 PM <phillip.wood123@gmail.com> wrote:\n>\n> Hi Tamir\n>\n> On 02/04/2024 11:26, Tamir Duberstein wrote:\n> > On Tue, Apr 2, 2024 at 11:10 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n> >> On 31/03/2024 07:49, Eric Sunshine wrote:\n> >> Thanks Eric. I'd have thought that \"git worktree list\" would say\n> >> something about the branch being rebased if there was enough state lying\n> >> around to prevent the branch being deleted, but lets see. What does\n> >>\n> >>       ls $(git rev-parse --git-path rebase-merge) $(git rev-parse\n> >> --git-path rebase-apply)\n> >>\n> >> show when you run it in <my source dir>? Also is <my source dir> the\n> >> only worktree?\n> >\n> > % ls $(git rev-parse --git-path rebase-merge) $(git rev-parse\n> > --git-path rebase-apply)\n> > ls: .git/rebase-apply: No such file or directory\n> > ls: .git/rebase-merge: No such file or directory\n>\n> Thanks for trying that - at least we know it isn't a problem with\n> rebase. Lets check if there is a stale bisect (sorry I forgot about that\n> earlier). What do\n>\n>      cat .git/BISECT_START\n>      ls .git | grep -i bisect\n>\n> show?\n\nThis was the culprit! There was indeed a ` .git/BISECT_START`\ncontaining \"cleanup\". After deleting this file I am able to remove the\nbranch.\n\n> > Yes, it's the only worktree.\n> In that case can you check that\n>\n>      ls .git/worktrees\n>\n> fails because the directory is missing or shows an empty directory please.\n\n% cat .git/worktrees\n\ncat: .git/worktrees: No such file or directory\n\n> Thanks\n>\n> Phillip\n\nI guess the only action item would be to improve the error message.\n"},{"id":"492061","messageId":"566bc6ac-d4d6-45e2-9875-575e187280a7@gmail.com","threadId":"61218","inReplyTo":"CAEYvaskG0BBVr+nsQ+iof=AXu3dcQHx0aRRrKRrf8e_NFANL9A@mail.gmail.com","subject":"Re: bug report: spurious \"cannot delete branch '%s' used by worktree\"","fromName":"","fromEmail":"phillip.wood123@gmail.com","sentAt":"2024-04-02T15:15:37Z","receivedAt":"2024-04-02T15:15:40Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 02/04/2024 12:56, Tamir Duberstein wrote:\n\n[cc'ing Christian who knows more about \"git bisect\" than me]\n\n> On Tue, Apr 2, 2024 at 12:29 PM <phillip.wood123@gmail.com> wrote:\n>> On 02/04/2024 11:26, Tamir Duberstein wrote:\n>>> On Tue, Apr 2, 2024 at 11:10 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n>>>> On 31/03/2024 07:49, Eric Sunshine wrote:\n>> Thanks for trying that - at least we know it isn't a problem with\n>> rebase. Lets check if there is a stale bisect (sorry I forgot about that\n>> earlier). What do\n>>\n>>       cat .git/BISECT_START\n>>       ls .git | grep -i bisect\n>>\n>> show?\n> \n> This was the culprit! There was indeed a ` .git/BISECT_START`\n> containing \"cleanup\". After deleting this file I am able to remove the\n> branch.\n\nOh good I'm glad we've found the problem.\n\n> I guess the only action item would be to improve the error message.\n\nYes, there was some discussion about that relatively recently when the \nmessage was changed to say \"in use\" rather than \"checked out\". Adding \nthe appropriate command name into the message would help.\n\nWhen bisecting \"git switch\" prints a warning but still switches \nbranches, \"git checkout\" performs the checkout with no warning. I wonder \nif (a) \"git switch\" should refuse to run without \"--detach\" when there \nis a bisection in progress and (b) if \"git bisect\" could be more helpful \nwhen it finds the broken commit by telling the user that they should run \n\"git bisect reset\" to clean up.\n\nBest Wishes\n\nPhillip\n"}]}