簡體   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