git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: bug report: I was allowed to "git checkout -b" while mid-rebase

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 19, 2025, 17:31 UTC
Message-ID
<xmqq34bvab8x.fsf@gitster.g>
In-Reply-To
<CAMq4opPBGT0Rv25DnEMHPjA=W_Ut2BDsN0KmxD2_xGTJa9erJQ@mail.gmail.com>
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.

Previous: Jacob KellerNext: Grant Birchmeier
Message 3 of 5 in “bug report: I was allowed to "git checkout -b" while mid-rebase”
  1. Grant BirchmeierJun 19, 2025
  2. Jacob KellerJun 19, 2025
  3. Junio C HamanoJun 19, 2025
  4. Grant BirchmeierJun 19, 2025
  5. Re bug report: I was allowed to "git checkout -b" while mid-rebaseK Jayatheerth, Jun 19, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.