繁体   English   中英

错误:如果没有先前的提交就无法“挤压”您可以使用“git rebase --edit-todo”修复此问题,然后运行“git rebase --continue”

[英]Error: cannot 'squash' without a previous commit You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'

我在 bitbucket 中有以下提交,我想将所有提交压缩为一个提交。

当我执行git rebase -i HEAD~5时,它会以相反的顺序显示 git bash 上的所有提交,其中最后一个提交即是最后一个提交。

pick 104e52ffdb IA-31774 Commit 1
pick 157be0f3b3 IA-31774 Commit 2
pick 4619cf38be IA-31774 Commit 3
pick e89937fca9 IA-31774 Commit 4
pick 38c54ea317 IA-31774 Commit 5

++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++

我尝试了以下选项。

s 104e52ffdb IA-31774 Commit 1
s 157be0f3b3 IA-31774 Commit 2
s 4619cf38be IA-31774 Commit 3
p e89937fca9 IA-31774 Commit 4
r 38c54ea317 IA-31774 Commit 5

我尝试了上述选项,但出现以下错误。

错误:如果没有先前的提交就无法“挤压”您可以使用“git rebase --edit-todo”修复此问题,然后运行“git rebase --continue”。 或者你可以使用 'git rebase --abort' 中止 rebase。

任何人都可以帮助我如何将所有 5 个提交压缩为单个提交,还让我知道将所有 5 个提交压缩为单个提交应遵循的步骤。

提前致谢。

通常,行是按从上到下的顺序执行的。

为了压制一切,这应该起作用:

r 104e52ffdb IA-31774 Commit 1
s 157be0f3b3 IA-31774 Commit 2
s 4619cf38be IA-31774 Commit 3
s e89937fca9 IA-31774 Commit 4
s 38c54ea317 IA-31774 Commit 5

您改写并保留第一个提交并压制所有其他提交。 如果你想在提交 1 之后删除所有提交的消息,你应该使用ffixup而不是 squash..

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM