首页 > 解决方案 > 由于未跟踪的工作树文件将被合并错误覆盖,因此无法继续使用 rebase

问题描述

我目前正在使用 合并两个分支git rebase -i,有一个提交不允许我继续使用变基。当我检查提交时,我看到有一些文件但没有与分支冲突。

在此处输入图像描述

我尝试使用fixupandedit因为我想也许我做了一些改变,但事实并非如此。当我运行时,git rebase --continue我收到以下消息:

error: The following untracked working tree files would be overwritten by merge:

它还显示如上图所示的文件,并带有以下消息

Please move or remove them before you merge.
Aborting
hint: Could not execute the todo command
hint: 
hint:     pick 430847f3fe3f80162a93f62db3e016f3c9a97cc1 Include html2text package
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

在这种情况下我能做什么?这是否意味着,我可以重新提交这个提交?我必须堕胎吗?

标签: git

解决方案


error: The following untracked working tree files would be overwritten by merge:

这正是它所说的:某些文件存在于您的工作树中但不在您的索引中,因此它们是untrackedgit cherry-pick继续作为序列一部分的下一个git rebase将覆盖它们。(这里主要的棘手部分是git rebase主要由一系列git cherry-pick命令组成,并且git cherry-pick使用了 Git 的合并机制,因此即使您正在git rebase合并一些文件。)

...但我没有在它所说的文件夹中看到那些文件。vendor/soundasleep我检查 atom 时没有文件夹...

这才是真正令人费解的部分。Git 肯定会认为这些文件存在于您的工作树中。请注意,如果您使用的是典型的 Windows 或 MacOS 系统,则底层文件系统会进行大小写折叠,因此如果有vendor/SoundAsleep文件夹或VENDOR/soundasleep文件夹或任何类似的东西,这也很重要。

(我不使用原子编辑器,我自己会在它之外进行任何检查。)


推荐阅读