All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Grant Birchmeier <gbirchmeier@connamara.com>
Cc: git@vger.kernel.org
Subject: Re: bug report: I was allowed to "git checkout -b" while mid-rebase
Date: Thu, 19 Jun 2025 10:31:58 -0700	[thread overview]
Message-ID: <xmqq34bvab8x.fsf@gitster.g> (raw)
In-Reply-To: <CAMq4opPBGT0Rv25DnEMHPjA=W_Ut2BDsN0KmxD2_xGTJa9erJQ@mail.gmail.com> (Grant Birchmeier's message of "Wed, 18 Jun 2025 19:12:01 -0500")

Grant Birchmeier <gbirchmeier@connamara.com> writes:

> *What did you expect to happen? (Expected behavior)*
>
> I would expect an error message and a refusal to execute the `git checkout
> -b` command.

I am not sure if it is such a good idea, though.

I just did a short experiment:

 * randomly work and end up with many commits on 'master'; they are
   about two independent topics A and B, so I want to separate them out.

 * "git rebase -i master" and edit the todo list to group the
   commits into two sets, the commits about the topic A comes first
   and then the commits about the topic B on top.

 * Arrange that before processing the first commit for topic B, the
   control is given back to the end user.  If the last commit of the
   topic A stops due to conflict, that is fine.  Or an explicit
   "break" inserted into the todo list would work well.

 * When topic A's commits are replayed on top of 'master', do "git
   branch A" and then "git checkout -b B master".  The history
   recorded on branch A is now about the development of topic A on
   top of master, without a trace of any topic B.

 * "git rebase --continue" and I ended up on branch B, which
   recorded the development of topic B on top of master, without a
   trace of any topic A.

and it seems to work as expected as a handy way to clean up a mixed
bag into separate topic branches.

      parent reply	other threads:[~2025-06-19 17:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19  0:12 bug report: I was allowed to "git checkout -b" while mid-rebase Grant Birchmeier
2025-06-19  0:19 ` Jacob Keller
     [not found] ` <CABURp0orQ-UCzDgJc=STPQZaaEEGwR0GM-GZq_Ty3BXBKYS2iQ@mail.gmail.com>
2025-06-19  2:30   ` Grant Birchmeier
2025-06-19  8:35     ` Re " K Jayatheerth
2025-06-19 17:31 ` Junio C Hamano [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=xmqq34bvab8x.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=gbirchmeier@connamara.com \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.