簡體   English   中英

當所有當前待辦事項都設置為“reword”時,如何在交互式 rebase 中使用“git rebase --edit-todo”cmd?

[英]How do you use the `git rebase --edit-todo` cmd in interactive rebase when all current to-do's are set to `reword`?

我最終沒有時間完成 rebase。 問題是我不知道如何編輯我的原始待辦事項列表,因為我所有當前的待辦事項都被reword ,每次我完成改寫提交消息后,它會自動打開 Vim 中的下一個提交進行改寫。

如果我正在編輯任何提交,我可以運行git rebase --edit-todo ,將其余提交更改為pick ,然后運行git rebase --continue

有人知道在我的情況下是否有辦法編輯待辦事項嗎? 還是有其他方法?

注意:我不想中止 rebase 並丟失我所有的工作。

嘗試在某處啟動另一個 shell 實例,例如,在另一個窗口中或在 vim 中使用:shell 確保此 shell 實例位於正確的存儲庫目錄( cd path/to/repo如有必要)並在那里運行git rebase --edit-todo 寫出更新的指令並退出此編輯器,然后返回進行中的 rebase。 當您完成當前的“改寫”后,Git應該會選擇編輯過的指令。

我擔心舊版本的 Git 之間可能存在一些差異,其中git rebase -i都是一個大的 shell 腳本,而新版本的git rebase -i使用 C 編碼的音序器。 它們的行為一般應該是相同的,所以幸運的是,這適用於所有 Git,無論是舊的還是新的。

正如我的經歷一樣,我遇到了同樣的錯誤:

error: The following untracked working tree files would be overwritten by merge:
    vtysh/vtysh_cmd.db
Please move or remove them before you merge.
Aborting
hint: Could not execute the todo command
hint: 
hint:     pick 12b0d7cf571a0296fd0e3d64cf254a1d3237d90c resolve discussion
hint: 
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint: 
hint:     git rebase --edit-todo
hint:     git rebase --continue
Could not apply 12b0d7cf5... resolve discussion

這意味着我想做一項工作(創建一個文件 eq. vtysh/vtysh_cmd.db)但它現在已經存在。

解決方案:刪除這個文件( rm vtysh/vtysh_cmd.db )然后執行git rebase --continue

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM