问题:
I am trying to merge 2 commits into 1, so I followed “squashing commits with rebase” from git ready . 我正在尝试将2个提交合并为1个,因此我遵循了git ready中的“使用rebase压缩提交” 。
I ran 我跑了
git rebase --interactive HEAD~2
In the resulting editor, I change pick
to squash
and then save-quit, but the rebase fails with the error 在结果编辑器中,我将pick
改为squash
,然后保存退出,但是rebase失败并显示以下错误
Cannot 'squash' without a previous commit 没有先前的提交就无法“压扁”
Now that my work tree has reached this state, I'm having trouble recovering. 现在我的工作树已达到此状态,我无法恢复。 The command git rebase --interactive HEAD~2
fails with git rebase --interactive HEAD~2
命令失败并显示
Interactive rebase already started 交互式基础已经开始
and git rebase --continue
fails with 和git rebase --continue
失败
Cannot 'squash' without a previous commit 没有先前的提交就无法“压扁”
解决方案:
参考一: https://stackoom.com/question/Akuu/如果我已经开始重新设置基准-如何将两个提交合并为一个参考二: https://oldbug.net/q/Akuu/How-can-I-merge-two-commits-into-one-if-I-already-started-rebase
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/3227486