如果我已经开始重新设置基准,如何将两个提交合并为一个?

跟風遠走 提交于 2020-04-10 10:22:24

问题:

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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!