From: Junio C Hamano <gitster@pobox.com>
To: Josh Soref <jsoref@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [rebase] `fatal: cannot force update the branch ... checkout out at ...` is confusing when it isn't active
Date: Wed, 12 Jul 2023 13:49:47 -0700 [thread overview]
Message-ID: <xmqq5y6osvmc.fsf@gitster.g> (raw)
In-Reply-To: <CACZqfqDE-SCOqVX9a8KCLAn1zSVbYxuCeU8Y=3-nhj5wbL=AWQ@mail.gmail.com> (Josh Soref's message of "Wed, 12 Jul 2023 16:33:22 -0400")
Josh Soref <jsoref@gmail.com> writes:
> Josh Soref writes:
>> fatal: cannot force update the branch 'main' checked out at
>> '/private/var/folders/r3/n29fz25x72x191fdv6mhhr3m0000gp/T/tmp.fGD64HAf'
>
>> It's true git in the repository does have a pin of sorts for the
>> `main` branch and that `git-rebase` would be very upset if the
>> branch's location were changed, but as an end user, the `main` branch
>> is not checked out, the `next` branch is checked out.
>
> Junio C Hamano wrote:
>> Fair enough. Perhaps "cannot force update the branch 'main' in use"
>> would alleviate the confusion?
>
> That would be better.
>
> Even better would be to tell me what's using it (rebase). I'm not sure
> how possible that is.
When branch.c:prepare_checked_out() notices which branch is in use
in what way in which worktree, it does check many conditions (e.g.
"in this worktree, is a rebase in progress and if so which branch is
being affected?") but the information is lost there to only record a
mapping from branch names to worktree location. So "it is in use
over there" with exact location is given, but "how it is used" is
not recorded.
It shouldn't be a rocket surgery to teach the function to leave that
information, but I am not offhand sure how valuable it would be to
do so. After all, once you learn which worktree of yours is using
the branch you wanted to touch, you'll either know already or it
would be easy for you to find out what you have been doing in that
other worktree anyway, no?
next prev parent reply other threads:[~2023-07-12 20:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 0:45 [rebase] `fatal: cannot force update the branch ... checkout out at ...` is confusing when it isn't active Josh Soref
2023-07-12 15:04 ` Junio C Hamano
2023-07-12 20:33 ` Josh Soref
2023-07-12 20:49 ` Junio C Hamano [this message]
2023-07-12 22:25 ` Re* " Junio C Hamano
2023-07-21 21:53 ` [PATCH v2] branch: update the message to refuse touching a branch in-use Junio C Hamano
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=xmqq5y6osvmc.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jsoref@gmail.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;
as well as URLs for NNTP newsgroup(s).