{"thread":{"id":"59386","subject":"git rebase issue","startedAt":"2023-03-13T12:36:17Z","lastAt":"2025-03-23T01:38:06Z","messageCount":10,"participants":["Andy Shevchenko","Felipe Contreras","Jeff King","Eric Sunshine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"473453","messageId":"CAHp75VfTQZ8vFQXZKgbsedG2BOad-pv9fCVkNkX+kFAxhnhhXQ@mail.gmail.com","threadId":"59386","inReplyTo":null,"subject":"git rebase issue","fromName":"Andy Shevchenko","fromEmail":"andy.shevchenko@gmail.com","sentAt":"2023-03-13T12:35:03Z","receivedAt":"2023-03-13T12:36:17Z","isPatch":false,"sender":{"key":"andy.shevchenko@gmail.com","avatar":"https://gravatar.com/avatar/e7fccbe23f198167f8b4c119a3a8729d3cec5b3268293ffe07ee15a50c39938b?d=mp&s=160"},"body":"Hi!\n\nRecently Debian has updated the Git to 2.39.2 and broke my user case\n(I believe it's a problem in the Git itself and not Debian packaging\nor so).\n\nSo, my use case is to run\n\n  git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\" \"$branch\"\n\nin the repository that is made out of bare + a few worktrees.\n\nPreviously everything was working (my bare repository points to one of\nthe existing branch:\nIn shell prompt: ...(BARE:netboot)]$\n\nWith the new release I have got an error\n\n  fatal: 'netboot' is already checked out at ...\n\nTo work around this I have to split the above to\n\n  git checkout --ignore-other-worktrees \"$branch\"\n  git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\"\n\nwhich makes all these too inconvenient.\n\nAny suggestions?\n\n-- \nWith Best Regards,\nAndy Shevchenko\n"},{"id":"473454","messageId":"CAHp75VcZJPysc2-NXTC53XvOwbx-UfPO9SbsBJFb72JGHFyO1A@mail.gmail.com","threadId":"59386","inReplyTo":"CAHp75VfTQZ8vFQXZKgbsedG2BOad-pv9fCVkNkX+kFAxhnhhXQ@mail.gmail.com","subject":"Re: git rebase issue","fromName":"Andy Shevchenko","fromEmail":"andy.shevchenko@gmail.com","sentAt":"2023-03-13T12:58:38Z","receivedAt":"2023-03-13T12:59:57Z","isPatch":false,"sender":{"key":"andy.shevchenko@gmail.com","avatar":"https://gravatar.com/avatar/e7fccbe23f198167f8b4c119a3a8729d3cec5b3268293ffe07ee15a50c39938b?d=mp&s=160"},"body":"On Mon, Mar 13, 2023 at 2:35 PM Andy Shevchenko\n<andy.shevchenko@gmail.com> wrote:\n>\n> Hi!\n>\n> Recently Debian has updated the Git to 2.39.2 and broke my user case\n> (I believe it's a problem in the Git itself and not Debian packaging\n> or so).\n\nForgot to add that last week it was working nicely (I don't remember\nthe version, but according to Debian changelog it looks like 2.38.4\nwas working fine to me.\n\n> So, my use case is to run\n>\n>   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\" \"$branch\"\n>\n> in the repository that is made out of bare + a few worktrees.\n>\n> Previously everything was working (my bare repository points to one of\n> the existing branch:\n> In shell prompt: ...(BARE:netboot)]$\n>\n> With the new release I have got an error\n>\n>   fatal: 'netboot' is already checked out at ...\n>\n> To work around this I have to split the above to\n>\n>   git checkout --ignore-other-worktrees \"$branch\"\n>   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\"\n>\n> which makes all these too inconvenient.\n>\n> Any suggestions?\n\n-- \nWith Best Regards,\nAndy Shevchenko\n"},{"id":"473762","messageId":"CAHp75Vc419vikJ184syJHN7rxyaspHzgtT9a_uFA=CT=cdqo-w@mail.gmail.com","threadId":"59386","inReplyTo":"CAHp75VcZJPysc2-NXTC53XvOwbx-UfPO9SbsBJFb72JGHFyO1A@mail.gmail.com","subject":"Re: git rebase issue","fromName":"Andy Shevchenko","fromEmail":"andy.shevchenko@gmail.com","sentAt":"2023-03-20T12:10:38Z","receivedAt":"2023-03-20T12:11:29Z","isPatch":false,"sender":{"key":"andy.shevchenko@gmail.com","avatar":"https://gravatar.com/avatar/e7fccbe23f198167f8b4c119a3a8729d3cec5b3268293ffe07ee15a50c39938b?d=mp&s=160"},"body":"On Mon, Mar 13, 2023 at 2:58 PM Andy Shevchenko\n<andy.shevchenko@gmail.com> wrote:\n> On Mon, Mar 13, 2023 at 2:35 PM Andy Shevchenko\n> <andy.shevchenko@gmail.com> wrote:\n> >\n> > Hi!\n> >\n> > Recently Debian has updated the Git to 2.39.2 and broke my user case\n> > (I believe it's a problem in the Git itself and not Debian packaging\n> > or so).\n>\n> Forgot to add that last week it was working nicely (I don't remember\n> the version, but according to Debian changelog it looks like 2.38.4\n> was working fine to me.\n>\n> > So, my use case is to run\n> >\n> >   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\" \"$branch\"\n> >\n> > in the repository that is made out of bare + a few worktrees.\n> >\n> > Previously everything was working (my bare repository points to one of\n> > the existing branch:\n> > In shell prompt: ...(BARE:netboot)]$\n> >\n> > With the new release I have got an error\n> >\n> >   fatal: 'netboot' is already checked out at ...\n> >\n> > To work around this I have to split the above to\n> >\n> >   git checkout --ignore-other-worktrees \"$branch\"\n> >   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\"\n> >\n> > which makes all these too inconvenient.\n> >\n> > Any suggestions?\n\nSo, what should I do? Today I got again to help manually with my (used\nto working) scripts.\n\n\n-- \nWith Best Regards,\nAndy Shevchenko\n"},{"id":"473772","messageId":"CAMP44s2-hMXk0NSn0-SQWaxX3TOpYSbc17A-XGv0oi_D_Ws0dw@mail.gmail.com","threadId":"59386","inReplyTo":"CAHp75Vc419vikJ184syJHN7rxyaspHzgtT9a_uFA=CT=cdqo-w@mail.gmail.com","subject":"Re: git rebase issue","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2023-03-20T14:41:24Z","receivedAt":"2023-03-20T14:41:39Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Mon, Mar 20, 2023 at 6:32 AM Andy Shevchenko\n<andy.shevchenko@gmail.com> wrote:\n>\n> On Mon, Mar 13, 2023 at 2:58 PM Andy Shevchenko\n> <andy.shevchenko@gmail.com> wrote:\n> > On Mon, Mar 13, 2023 at 2:35 PM Andy Shevchenko\n> > <andy.shevchenko@gmail.com> wrote:\n> > >\n> > > Hi!\n> > >\n> > > Recently Debian has updated the Git to 2.39.2 and broke my user case\n> > > (I believe it's a problem in the Git itself and not Debian packaging\n> > > or so).\n> >\n> > Forgot to add that last week it was working nicely (I don't remember\n> > the version, but according to Debian changelog it looks like 2.38.4\n> > was working fine to me.\n> >\n> > > So, my use case is to run\n> > >\n> > >   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\" \"$branch\"\n> > >\n> > > in the repository that is made out of bare + a few worktrees.\n> > >\n> > > Previously everything was working (my bare repository points to one of\n> > > the existing branch:\n> > > In shell prompt: ...(BARE:netboot)]$\n> > >\n> > > With the new release I have got an error\n> > >\n> > >   fatal: 'netboot' is already checked out at ...\n> > >\n> > > To work around this I have to split the above to\n> > >\n> > >   git checkout --ignore-other-worktrees \"$branch\"\n> > >   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\"\n> > >\n> > > which makes all these too inconvenient.\n> > >\n> > > Any suggestions?\n>\n> So, what should I do? Today I got again to help manually with my (used\n> to working) scripts.\n\nDo you have a sequence of steps to reproduce the issue?\n\nWith that it should be trivial to do `git bisect` and figure out which\ncommit introduced the regression.\n\n-- \nFelipe Contreras\n"},{"id":"473787","messageId":"CAHp75VeMoXZdr++6BiOMhOnSqm5rPe+t0bNzpLJsCuGp8NU=wA@mail.gmail.com","threadId":"59386","inReplyTo":"20230320170158.GA2614670@coredump.intra.peff.net","subject":"Re: git rebase issue","fromName":"Andy Shevchenko","fromEmail":"andy.shevchenko@gmail.com","sentAt":"2023-03-20T17:20:44Z","receivedAt":"2023-03-20T17:26:14Z","isPatch":false,"sender":{"key":"andy.shevchenko@gmail.com","avatar":"https://gravatar.com/avatar/e7fccbe23f198167f8b4c119a3a8729d3cec5b3268293ffe07ee15a50c39938b?d=mp&s=160"},"body":"On Mon, Mar 20, 2023 at 7:02 PM Jeff King <peff@peff.net> wrote:\n\n\n> [Please don't put random folks in the to/cc unless you think they have\n> specific knowledge related to your problem.]\n\nSorry about that, but my reaction was to the silence. I found your\nname is a top contributor, so that's why I have chosen your name.\n\n> On Mon, Mar 20, 2023 at 02:10:38PM +0200, Andy Shevchenko wrote:\n>\n> > > > With the new release I have got an error\n> > > >\n> > > >   fatal: 'netboot' is already checked out at ...\n> > > >\n> > > > To work around this I have to split the above to\n> > > >\n> > > >   git checkout --ignore-other-worktrees \"$branch\"\n> > > >   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\"\n> > > >\n> > > > which makes all these too inconvenient.\n> > > >\n> > > > Any suggestions?\n> >\n> > So, what should I do? Today I got again to help manually with my (used\n> > to working) scripts.\n>\n> Running \"git log --grep=already.checked.out\" suggests that it may be\n> b5cabb4a967 (rebase: refuse to switch to branch already checked out\n> elsewhere, 2020-02-23).\n\nThank you.\n\nIndeed, reverting that (manually as it's a conflict with v2.40.0\ncurrent tree) fixes my issue.\n\n> Adding its author to the cc, who may be able to say more. But my\n> understanding is that this was probably fixing a bug (though I don't\n> know all the implications of having a branch checked out in multiple\n> worktrees).\n\nNote, in my case it's \"checked\" in the BARE repository, which means\nit's actually not.\nThis case shouldn't be an impediment or racy AFAIU.\n\n-- \nWith Best Regards,\nAndy Shevchenko\n"},{"id":"473790","messageId":"20230320170158.GA2614670@coredump.intra.peff.net","threadId":"59386","inReplyTo":"CAHp75Vc419vikJ184syJHN7rxyaspHzgtT9a_uFA=CT=cdqo-w@mail.gmail.com","subject":"Re: git rebase issue","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-03-20T17:01:58Z","receivedAt":"2023-03-20T17:34:18Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"[Please don't put random folks in the to/cc unless you think they have\nspecific knowledge related to your problem.]\n\nOn Mon, Mar 20, 2023 at 02:10:38PM +0200, Andy Shevchenko wrote:\n\n> > > With the new release I have got an error\n> > >\n> > >   fatal: 'netboot' is already checked out at ...\n> > >\n> > > To work around this I have to split the above to\n> > >\n> > >   git checkout --ignore-other-worktrees \"$branch\"\n> > >   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\"\n> > >\n> > > which makes all these too inconvenient.\n> > >\n> > > Any suggestions?\n> \n> So, what should I do? Today I got again to help manually with my (used\n> to working) scripts.\n\nRunning \"git log --grep=already.checked.out\" suggests that it may be\nb5cabb4a967 (rebase: refuse to switch to branch already checked out\nelsewhere, 2020-02-23).\n\nAdding its author to the cc, who may be able to say more. But my\nunderstanding is that this was probably fixing a bug (though I don't\nknow all the implications of having a branch checked out in multiple\nworktrees).\n\n-Peff\n"},{"id":"474040","messageId":"CAMP44s2hEudOpOcyXzZQNYtQSHXOd4NiPBboH=90RHEgF_Lamg@mail.gmail.com","threadId":"59386","inReplyTo":"CAHp75VeMoXZdr++6BiOMhOnSqm5rPe+t0bNzpLJsCuGp8NU=wA@mail.gmail.com","subject":"Re: git rebase issue","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2023-03-23T20:37:51Z","receivedAt":"2023-03-23T20:38:06Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Mon, Mar 20, 2023 at 12:11 PM Andy Shevchenko\n<andy.shevchenko@gmail.com> wrote:\n> On Mon, Mar 20, 2023 at 7:02 PM Jeff King <peff@peff.net> wrote:\n\n> > Adding its author to the cc, who may be able to say more. But my\n> > understanding is that this was probably fixing a bug (though I don't\n> > know all the implications of having a branch checked out in multiple\n> > worktrees).\n>\n> Note, in my case it's \"checked\" in the BARE repository, which means\n> it's actually not.\n> This case shouldn't be an impediment or racy AFAIU.\n\nIn that case I agree it should work, but when I tried to reproduce the\nissue the bare repository is ignored, only worktrees are considered.\n\nAre you sure the branch isn't checked out in other worktree(s)?\n\n-- \nFelipe Contreras\n"},{"id":"474077","messageId":"CAHp75VfSdth4B-oW8JCt4kBkehu6+B9ueQAJL1g99Ev3RiMKoQ@mail.gmail.com","threadId":"59386","inReplyTo":"CAMP44s2hEudOpOcyXzZQNYtQSHXOd4NiPBboH=90RHEgF_Lamg@mail.gmail.com","subject":"Re: git rebase issue","fromName":"Andy Shevchenko","fromEmail":"andy.shevchenko@gmail.com","sentAt":"2023-03-24T07:52:12Z","receivedAt":"2023-03-24T07:52:55Z","isPatch":false,"sender":{"key":"andy.shevchenko@gmail.com","avatar":"https://gravatar.com/avatar/e7fccbe23f198167f8b4c119a3a8729d3cec5b3268293ffe07ee15a50c39938b?d=mp&s=160"},"body":"On Thu, Mar 23, 2023 at 10:38 PM Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n>\n> On Mon, Mar 20, 2023 at 12:11 PM Andy Shevchenko\n> <andy.shevchenko@gmail.com> wrote:\n> > On Mon, Mar 20, 2023 at 7:02 PM Jeff King <peff@peff.net> wrote:\n>\n> > > Adding its author to the cc, who may be able to say more. But my\n> > > understanding is that this was probably fixing a bug (though I don't\n> > > know all the implications of having a branch checked out in multiple\n> > > worktrees).\n> >\n> > Note, in my case it's \"checked\" in the BARE repository, which means\n> > it's actually not.\n> > This case shouldn't be an impediment or racy AFAIU.\n>\n> In that case I agree it should work, but when I tried to reproduce the\n> issue the bare repository is ignored, only worktrees are considered.\n>\n> Are you sure the branch isn't checked out in other worktree(s)?\n\nYes. Since the commit was in v2.26 already, and I have noticed the\nissue only recently, there are a few possibilities:\n1) Debian is to slow to update a Git (doesn't sound like the case);\n2) New version of the Git does something in the configuration files\nthat unveils the issue;\n3) Something else I've been missing?\n\nAs for 2) I have found a new config.worktree which I tried to remove,\nnothing changed. Also I disabled extended worktree configuration in\nthe main (~/.gitconfig) one. Didn't help either.\n\nI have a bare repo with a Linux kernel and two worktrees. The HEAD in\nthe bare points out to one of the branches which I try to rebase.\n\nBARE:xxx (as shown by Git prompt helper in the Bash)\n\n`git rebase -X ours --onto \"vN+1\" \"vN\" xxx` fails.\n\n\n-- \nWith Best Regards,\nAndy Shevchenko\n"},{"id":"514859","messageId":"CAHp75Vf8bB8o9feJHe4FpNo0TnfoRLG+C0roD4a1OaqN3NDj-A@mail.gmail.com","threadId":"59386","inReplyTo":"20230320170158.GA2614670@coredump.intra.peff.net","subject":"Re: git rebase issue","fromName":"Andy Shevchenko","fromEmail":"andy.shevchenko@gmail.com","sentAt":"2025-03-22T13:42:34Z","receivedAt":"2025-03-22T13:43:12Z","isPatch":false,"sender":{"key":"andy.shevchenko@gmail.com","avatar":"https://gravatar.com/avatar/e7fccbe23f198167f8b4c119a3a8729d3cec5b3268293ffe07ee15a50c39938b?d=mp&s=160"},"body":"On Mon, Mar 20, 2023 at 7:02 PM Jeff King <peff@peff.net> wrote:\n> On Mon, Mar 20, 2023 at 02:10:38PM +0200, Andy Shevchenko wrote:\n>\n> > > > With the new release I have got an error\n> > > >\n> > > >   fatal: 'netboot' is already checked out at ...\n> > > >\n> > > > To work around this I have to split the above to\n> > > >\n> > > >   git checkout --ignore-other-worktrees \"$branch\"\n> > > >   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\"\n> > > >\n> > > > which makes all these too inconvenient.\n> > > >\n> > > > Any suggestions?\n> >\n> > So, what should I do? Today I got again to help manually with my (used\n> > to working) scripts.\n>\n> Running \"git log --grep=already.checked.out\" suggests that it may be\n> b5cabb4a967 (rebase: refuse to switch to branch already checked out\n> elsewhere, 2020-02-23).\n>\n> Adding its author to the cc, who may be able to say more. But my\n> understanding is that this was probably fixing a bug (though I don't\n> know all the implications of having a branch checked out in multiple\n> worktrees).\n\nFWIW, the last couple of versions (since I was not updating Git from\nthe sources too often, usually once per half a  year or so, I don't\nknow the exact version which fixes it to me, and I don't want spend\ntime to find that, because it works :) of Git seem to work properly to\nme. Thank you to everyone who made that happen!\n\n-- \nWith Best Regards,\nAndy Shevchenko\n"},{"id":"514867","messageId":"CAPig+cSswzF_Z9TsNEVi59ufdhwfZ+aN=NBmW+AmLwD2mFg8Pg@mail.gmail.com","threadId":"59386","inReplyTo":"CAHp75Vf8bB8o9feJHe4FpNo0TnfoRLG+C0roD4a1OaqN3NDj-A@mail.gmail.com","subject":"Re: git rebase issue","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2025-03-23T01:37:54Z","receivedAt":"2025-03-23T01:38:06Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Mar 22, 2025 at 9:43 AM Andy Shevchenko\n<andy.shevchenko@gmail.com> wrote:\n> On Mon, Mar 20, 2023 at 7:02 PM Jeff King <peff@peff.net> wrote:\n> > On Mon, Mar 20, 2023 at 02:10:38PM +0200, Andy Shevchenko wrote:\n> > > > > With the new release I have got an error\n> > > > >   fatal: 'netboot' is already checked out at ...\n> > > > > To work around this I have to split the above to\n> > > > >   git checkout --ignore-other-worktrees \"$branch\"\n> > > > >   git rebase --rebase-merges -X ours --onto \"$newbase\" \"$oldbase\"\n> > > > > which makes all these too inconvenient.\n> >\n> > Running \"git log --grep=already.checked.out\" suggests that it may be\n> > b5cabb4a967 (rebase: refuse to switch to branch already checked out\n> > elsewhere, 2020-02-23).\n>\n> FWIW, the last couple of versions (since I was not updating Git from\n> the sources too often, usually once per half a  year or so, I don't\n> know the exact version which fixes it to me, and I don't want spend\n> time to find that, because it works :) of Git seem to work properly to\n> me. Thank you to everyone who made that happen!\n\nThis was very likely fixed by 78a95e0d80 (worktree: detect from\nsecondary worktree if main worktree is bare, 2025-02-05); see [1].\n\nRegarding the attempt you cited in [2] in which you removed\nconfig.worktree and disabled extensions.worktreeConfig, I suspect the\nreason you didn't see any change in behavior is because you didn't\nre-add \"core.bare=true\" to <repo>.git/config.\n\n[1]: https://lore.kernel.org/git/pull.1829.v4.git.1738737014194.gitgitgadget@gmail.com/\n[2]: https://lore.kernel.org/git/CAHp75VfSdth4B-oW8JCt4kBkehu6+B9ueQAJL1g99Ev3RiMKoQ@mail.gmail.com/\n"}]}