public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel•com>
To: Grant Birchmeier <gbirchmeier@connamara•com>, <git@vger•kernel.org>
Subject: Re: bug report: I was allowed to "git checkout -b" while mid-rebase
Date: Wed, 18 Jun 2025 17:19:30 -0700	[thread overview]
Message-ID: <30cf835f-925c-4d33-a353-ee42e712fed7@intel.com> (raw)
In-Reply-To: <CAMq4opPBGT0Rv25DnEMHPjA=W_Ut2BDsN0KmxD2_xGTJa9erJQ@mail.gmail.com>



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.


  reply	other threads:[~2025-06-19  0:19 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 [this message]
     [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

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=30cf835f-925c-4d33-a353-ee42e712fed7@intel.com \
    --to=jacob.e.keller@intel$(echo .)com \
    --cc=gbirchmeier@connamara$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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