Re: "git branch -f" corrupt other worktree
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- May 2, 2019, 12:29 UTC
- Message-ID
- <CACsJy8CJ_PB+QKp-T-yTHNPYgjEEVN39QbnAu4kKzGGcEQ0ezA@mail.gmail.com>
- In-Reply-To
- <CAA2qrhBmbSe5R0xQPBZiRcz0MGG=JcF4BjxHqmyeTFNR19FKbg@mail.gmail.com>
On Thu, May 2, 2019 at 6:59 PM frank kulow <kulow.f@googlemail.com> wrote:
Show 16 quoted lines
> > git version 2.21.0.windows.1 > > > /c/tmp/gt (Branch_702091a0) > $ git worktree add ../wt master > Preparing worktree (checking out 'master') > HEAD is now at f534c32 4 > > > /c/tmp/gt (Branch_702091a0) > $ git branch -D master > error: Cannot delete branch 'master' checked out at 'C:/tmp/wt' > > #but this is possible: > > > /c/tmp/gt (Branch_702091a0) > $ git branch -f master HEAD
I admit I didn't see this. But I don't know how far we would go protecting other worktrees. You give --force and that usually means "Yes I know what I'm doing, don't stop me". If --force rejects in this case, what would be the real force, --force --force maybe, or fall back to "git update-ref"?
Show 15 quoted lines
> > #and the other worktree is now corrupted: > > > /c/tmp/wt (master) > $ git status > On branch master > Changes to be committed: > (use "git reset HEAD <file>..." to unstage) > > modified: txt.txt > deleted: txtb.txt > > > > greetings f.kulow
-- Duy