From: Eric Sunshine Date: Thu, 23 Nov 2023 17:09:38 GMT Subject: Re: [PATCH 2/2] checkout: forbid "-B " from touching a branch used elsewhere Message-ID: In-Reply-To: On Thu, Nov 23, 2023 at 11:33 AM Phillip Wood wrote: > On 23/11/2023 06:00, Junio C Hamano wrote: > > "git checkout -B []", being a "forced" version > > of "-b", switches to the , after optionally resetting its > > tip to the , even if the is in use in another > > worktree, which is somewhat unexpected. > > > > Protect the using the same logic that forbids "git checkout > > " from touching a branch that is in use elsewhere. > > > > This is a breaking change that may deserve backward compatibliity > > warning in the Release Notes. The "--ignore-other-worktrees" option > > can be used as an escape hatch if the finger memory of existing > > users depend on the current behaviour of "-B". > > I think this change makes sense and I found the implementation here much > easier to understand than a previous attempt at > https://lore.kernel.org/git/20230120113553.24655-1-carenas@gmail.com/ Thanks for digging up this link. Upon reading the problem report, I felt certain that we had seen this issue reported previously and that patches had been proposed, but I was unable to find the conversation (despite having taken part in it). I agree, also, that this two-patch series is simple to digest.