git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: frank kulow <kulow.f@googlemail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: "git branch -f" corrupt other worktree
Date: Thu, 2 May 2019 19:29:50 +0700	[thread overview]
Message-ID: <CACsJy8CJ_PB+QKp-T-yTHNPYgjEEVN39QbnAu4kKzGGcEQ0ezA@mail.gmail.com> (raw)
In-Reply-To: <CAA2qrhBmbSe5R0xQPBZiRcz0MGG=JcF4BjxHqmyeTFNR19FKbg@mail.gmail.com>

On Thu, May 2, 2019 at 6:59 PM frank kulow <kulow.f@googlemail.com> wrote:
>
> 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"?

>
> #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

  reply	other threads:[~2019-05-02 12:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02 11:58 "git branch -f" corrupt other worktree frank kulow
2019-05-02 12:29 ` Duy Nguyen [this message]
2019-05-02 12:51   ` Ævar Arnfjörð Bjarmason
2019-05-02 13:05     ` Duy Nguyen
2019-05-02 13:49       ` Duy Nguyen
2019-05-02 17:16       ` Duy Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACsJy8CJ_PB+QKp-T-yTHNPYgjEEVN39QbnAu4kKzGGcEQ0ezA@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=kulow.f@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).