Git development
 help / color / mirror / Atom feed
From: Aniket Gupta <aniketgupta3001@gmail.com>
To: phillip.wood@dunelm.org.uk
Cc: Toon Claes <toon@iotcl.com>, Patrick Steinhardt <ps@pks.im>,
	Junio C Hamano <gitster@pobox.com>,
	Nikita Bobko <nikita@nbobko.com>,
	git@vger.kernel.org
Subject: Re: [PATCH v2] history: refuse to rewrite branches used by other worktrees
Date: Mon, 30 Nov 2026 22:43:18 +0530	[thread overview]
Message-ID: <20261130171318.65085-1-aniketgupta3001@gmail.com> (raw)
In-Reply-To: <03c0d1e1-83c5-4324-b1c9-8023edc4b09e@gmail.com>

> I'd finish the sentence here.
> [...]
> We don't describe the advice in the documentation of the other
> options so I'd drop it.

Will be done in v3.

> That's true for other worktrees, but not the current worktree where
> the reason is that we'll end up losing work. I'd split it up

We can split it up. A worktree that has the branch checked out can be
left with an index and working tree that no longer match the branch. A
rebase is a different problem which is the same in every worktree,
i.e. if the branch is rewritten during the rebase, "git rebase
--continue" either fails, or throws the rewrite away, and "git rebase
--abort" brings back the old branch. In the docs I will group the
reasons by what is happening to the branch, not by which worktree it is
in.

> A branch that is being bisected in the current worktree cannot be
> rewritten because ... (is there actually a good reason?)

I rewrote the branch by hand while it was being bisected in the current
worktree and in a different one. Bisect could continue and "git bisect
reset" checked out the rewritten branch without problems. One thing I
noticed is that the result points to a commit from the old history,
which is no longer on the branch. I included this check because "git
branch -f" and "git rebase --update-refs" also leave a branch alone
while it is being bisected. I am in favour of keeping it. Suggestions?

      reply	other threads:[~2026-11-30 17:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:39 [PATCH] history: refuse to rewrite branches used by other worktrees Aniket Gupta
2026-11-23 13:10 ` Phillip Wood
2026-11-23 21:54   ` Aniket Gupta
2026-11-24 10:49     ` Phillip Wood
2026-11-24 14:09       ` Aniket Gupta
2026-11-23 20:14 ` Junio C Hamano
2026-11-23 21:54   ` Aniket Gupta
2026-11-27 17:32 ` [PATCH v2] " Aniket Gupta
2026-11-28  0:12   ` Junio C Hamano
2026-11-28  7:37     ` Aniket Gupta
2026-11-30 11:31   ` Toon Claes
2026-11-30 12:15     ` Aniket Gupta
2026-11-30 14:39     ` Phillip Wood
2026-11-30 17:13       ` Aniket Gupta
2026-11-30 14:49   ` Phillip Wood
2026-11-30 17:13     ` Aniket Gupta [this message]

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

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

  git send-email \
    --in-reply-to=20261130171318.65085-1-aniketgupta3001@gmail.com \
    --to=aniketgupta3001@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nikita@nbobko.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=ps@pks.im \
    --cc=toon@iotcl.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox