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

From: Jacob Keller <[email-masked]>
Date: Wed, 18 Jun 2025 17:19:30 -0700

On 6/18/2025 5:12 PM, Grant Birchmeier wrote:
> Hello.  I've attached my git-bugreport, but I'll copy/paste the salient
> parts here.  Thanks.  Let me know if I can provide anything else.
> 
> *What did you do before the bug happened? (Steps to reproduce your issue)*
> 
> I was rebasing a branch "ilogger" on my master branch.  While this rebase
> was still open, I accidentally ran `git checkout -b net5` (I meant to run
> it in a different console)... and it proceeded to switch me to the new
> branch even though the the rebase was still in progress.
> 
> *What did you expect to happen? (Expected behavior)*
> 
> I would expect an error message and a refusal to execute the `git checkout
> -b` command.
> 
> *What happened instead? (Actual behavior)*
> 
> It created a new branch "net5" off of my "ilogger" mid-rebase branch, and
> changed me to branch "net5".  I cannot change back to "ilogger" ("error:
> you need to resolve your current index first"), and it appears I will need
> to finish my rebase on "net5".  Even after I do that, I'm not sure what
> state "ilogger" will be in.
> 
> *What's different between what you expected and what actually happened?*
> 
> I think the proper bahavior is for the "git checkout -b" command to fail
> when the current branch is mid-rebase, just like it does when you run `git
> checkout` without the `-b`.
> 

One thing you could try is "git rebase --abort" to see if it can abort
the rebase and undo things. If that resets the index properly, then use
git reflog to make sure the ilogger branch is restored to the pre-rebase
state, or possibly use it on HEAD to find any intermediate commits/edits
you may have made while rebasing.