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

Re: Aborting 'rebase main feat' removes unversioned files

From
FBFedor Biryukov <fedor.birjukov@gmail.com>
Date
Sep 4, 2021, 18:32 UTC
Message-ID
<CAG2t84WrV7OZ_0KqOXsNCevEt046hyd-CAHCbWFBY4uBCFjLDg@mail.gmail.com>
In-Reply-To
<YTNJeY2U6tcOQiCh@coredump.intra.peff.net>

Actually it's the same on all operating systems. I just forgot to add a new base commit in main in the reproduction scenario - there was nothing to rebase... Here is the correct scenario along with the output.

+ git init -b main repo
Initialized empty Git repository in
/Users/ted/workspace/git-abort-bug/repo/.git/
+ cd repo
+ git commit -m base --allow-empty
[main (root-commit) 3299694] base
+ git checkout -b feat
Switched to a new branch 'feat'
+ echo feat >readme.txt
+ git add readme.txt
+ git commit -m txt=feat
[feat c9dc9b4] txt=feat
 1 file changed, 1 insertion(+)
 create mode 100644 readme.txt
+ git checkout main
Switched to branch 'main'
+ git commit -m new-base --allow-empty
[main c5c292c] new-base
+ echo precious > readme.txt
+ git rebase main feat
error: The following untracked working tree files would be overwritten by merge:
readme.txt
Please move or remove them before you merge.
Aborting
hint: Could not execute the todo command
hint:
hint:     pick c9dc9b4d5aca461f1a1bedd3b99b5c8533d5ef10 txt=feat
hint:
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint:
hint:     git rebase --edit-todo
hint:     git rebase --continue
Could not apply c9dc9b4... txt=feat
+ cat readme.txt
precious
+ git rebase --abort
+ cat readme.txt
feat
-Fedor
On Sat, Sep 4, 2021 at 12:24 PM Jeff King <peff@peff.net> wrote:
Show 22 quoted lines
>
> On Sat, Sep 04, 2021 at 12:03:49PM +0200, Fedor Biryukov wrote:
>
> > Here's the output from Windows, where everything works as expected.
> > [...]
> > PS> git rebase main feat
> > error: The following untracked working tree files would be overwritten
> > by checkout:
> >         readme.txt
> > Please move or remove them before you switch branches.
> > Aborting
> > error: could not detach HEAD
>
> Interesting that it behaves differently than the mac and linux versions.
> There are some changes between Git for Windows and regular upstream Git,
> but looking over the diff between the v2.33.0 releases, I don't see
> anything that might cause this discrepancy.
>
> If the problem used to occur on v2.31 and now doesn't, it might be
> interesting to bisect it.
>
> -Peff
Previous: Jeff KingNext: Jeff King
Message 8 of 15 in “Aborting 'rebase main feat' removes unversioned files”
  1. Fedor BiryukovSep 3, 2021
  2. Bagas SanjayaSep 4, 2021
  3. Jeff KingSep 4, 2021
  4. Fedor BiryukovSep 4, 2021
  5. Fedor BiryukovSep 4, 2021
  6. Fedor BiryukovSep 4, 2021
  7. Jeff KingSep 4, 2021
  8. Fedor BiryukovSep 4, 2021
  9. Jeff KingSep 4, 2021
  10. Elijah NewrenSep 5, 2021
  11. Ævar Arnfjörð BjarmasonSep 5, 2021
  12. Fedor BiryukovSep 5, 2021
  13. Elijah NewrenSep 8, 2021
  14. Junio C HamanoSep 5, 2021
  15. Elijah NewrenSep 8, 2021

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.