为什么交互式变基将我的提交压缩在一起?

Why is an interactive rebase squishing my commits together?

假设我有以下三个提交:

c - Third Commit
b - Second Commit
a - First Commit

我使用以下命令执行交互式变基(如所述in another Whosebug thread

$ git rebase --interactive bbc643cd^

In the default editor, modify 'pick' to 'edit' in the line whose commit you want to modify. Make your changes and then commit them with the same message you had before:

$ git commit --all --amend --no-edit

to modify the commit, and after that

$ git rebase --continue

问题是有时,当我完成后,提交被压缩为一个提交(最旧的提交,在我的示例中 a)。

好像和解决合并冲突的时候有关系,所以我怀疑我解决后可能继续错误。解决合并冲突后,我不确定是否需要简单地执行 git rebase --continue 或同时执行 $ git commit --all --amend --no-editgit rebase --continue。似乎在这两种情况下,我都在最后合并了提交,但我不确定。

我做错了什么?

确实如 Tobia Tesan 在评论中所说,--amend 选项将文件添加到最后一次提交,而不是创建新文件。

如果你放弃这个选项应该会很好。