當我想develop根據我的feature分支重新設定分支時,我面臨合并沖突。我使用 IntelliJ Idea 來執行單獨的 Git 命令。假設我有 3 個推送提交,我想使用--interactive模式壓縮和重新設定它們。

我選擇了所有三個提交,我選擇了squash,做一些改寫,然后點擊Rebase。

該程序失敗,并且出現在 Git 面板中Changes和 diff 面板上的Excel 檔案表示內容相同。我只能中止或重試 rebase,但繼續沒有意義,因為更改總是阻止我繼續。

這是控制臺輸出:
12:50:42.385: [myapplication] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false -c core.commentChar= rebase --interactive develop
Rebasing (1/2)
error: Your local changes to the following files would be overwritten by merge:
excel-file.xlsx
Please commit your changes or stash them before you merge.
Aborting
hint: Could not execute the todo command
hint:
hint: fixup 37d1fc57dff9c7e9a312c88cf78c176cb71dbb47 CommitMessageIsHere
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 37d1fc5... CommitMessageIsHere
有什么技巧可以克服這個障礙嗎?有可能以某種方式強制忽略和跳過這種合并沖突嗎?
uj5u.com熱心網友回復:
您使用 未跟蹤的副本開始了您的變基excel-file.xlsx,當git遇到包含“創建新excel-file.xlsx檔案”操作的提交時,他停止了。
在繼續之前,您必須以某種方式擱置這個未跟蹤的版本。
最簡單的方法是:
重命名磁盤上的檔案:
mv excel-file.xlsx excel-file.xlsx.tmp運行
git rebase --continue:
要么 IntelliJ 有一個看起來像“繼續變基”的按鈕,要么你可以從命令列運行這個命令,一旦 rebase 完成:
您可以比較兩個檔案的內容,并決定正確的操作是 - 更新跟蹤版本,洗掉 tmp 檔案...
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/368604.html
