From: Andy Koppe Date: Thu, 23 Nov 2023 22:03:42 GMT Subject: Re: git checkout -B lets you checkout a branch that is already checked out in another worktree Inbox Message-ID: In-Reply-To: On 23/11/2023 05:58, Junio C Hamano wrote: > Junio C Hamano writes: > >> I guess we could change the behaviour so that >> >> git checkout -B [] >> >> fails when is an existing branch that is in use in another >> worktree, and allow "-f" to be used to override the safety, i.e., >> >> git checkout -f -B [] >> >> would allow the to be repointed to (or HEAD) >> even when it is used elsewhere. > > It turns out that for some reason "-f" is not how we decided to > override this one---there is "--ignore-other-worktrees" option. Presumably that's because -f means throwing away any local changes that are in the way of checking out the new HEAD, which you wouldn't necessarily want when trying to replace an existing branch. Andy